Skip to content

Commit

Permalink
Se finaliza el codigo y guardan imagenes
Browse files Browse the repository at this point in the history
  • Loading branch information
camilomarino committed Dec 28, 2020
1 parent 7cbd0e2 commit 9dc64fd
Show file tree
Hide file tree
Showing 54 changed files with 239 additions and 108 deletions.
130 changes: 75 additions & 55 deletions ProyectoFinal/Evaluate_results.ipynb

Large diffs are not rendered by default.

59 changes: 12 additions & 47 deletions ProyectoFinal/Solve_regularization.ipynb

Large diffs are not rendered by default.

19 changes: 15 additions & 4 deletions ProyectoFinal/Solve_restriction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,19 @@
},
{
"cell_type": "code",
"execution_count": 29,
"execution_count": 36,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"<Figure size 432x288 with 0 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"losses_s2k = np.array(losses_s2k)\n",
"np.save('arrays/A_s2k.npy', A_s2k)\n",
Expand All @@ -159,7 +169,7 @@
},
{
"cell_type": "code",
"execution_count": 34,
"execution_count": 38,
"metadata": {},
"outputs": [
{
Expand All @@ -176,7 +186,8 @@
}
],
"source": [
"plot_loss(losses_s2k)"
"plot_loss(losses_s2k)\n",
"plt.savefig('images/loss_s2k_restriccion.png')"
]
}
],
Expand Down
Binary file added ProyectoFinal/excel/all_results.xls
Binary file not shown.
Binary file added ProyectoFinal/excel/data_real.xls
Binary file not shown.
Binary file added ProyectoFinal/excel/data_s2k.xls
Binary file not shown.
Binary file added ProyectoFinal/excel/data_s2k_reg_10.0.xls
Binary file not shown.
Binary file added ProyectoFinal/excel/data_simple.xls
Binary file not shown.
132 changes: 132 additions & 0 deletions ProyectoFinal/excel/merge_excel.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import os"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [],
"source": [
"xlss = [xls for xls in os.listdir() if xls.endswith('xls')]\n",
"try:\n",
" xlss.remove('all_results.xls')\n",
"except ValueError:\n",
" pass"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['data_real.xls', 'data_s2k_reg_10.0.xls', 'data_s2k.xls', 'data_simple.xls']"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"xlss.sort()\n",
"xlss = [xlss[i] for i in [0, 2, 1, 3]]\n",
"xlss"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [],
"source": [
"dfs = list()\n",
"for xls in xlss:\n",
" df = pd.read_excel(xls, index_col=0)\n",
" dfs.append(df)\n",
" #print(df)"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [],
"source": [
"FULL_NAME = {\n",
" 'WHE': 'Whole-House Meter',\n",
" 'B1E': 'North Bedroom',\n",
" 'B2E': 'Master and South Bedroom',\n",
" 'BME': 'Basement Plugs and Lights',\n",
" 'CDE': 'Clothes Dryer',\n",
" 'CWE': 'Clothes Washer',\n",
" 'DNE': 'Dining Room Plugs',\n",
" 'DWE': 'Dishwasher',\n",
" 'EBE': 'Electronics Workbench',\n",
" 'EQE': 'Security/Network Equipment',\n",
" 'FGE': 'Kitchen Fridge',\n",
" 'FRE': 'Forced Air Furnace: Fan and Thermostat',\n",
" 'GRE': 'Garage',\n",
" 'HPE': 'Heat Pump',\n",
" 'HTE': 'Instant Hot Water Unit',\n",
" 'OFE': 'Home Office',\n",
" 'OUE': 'Outside Plug',\n",
" 'RSE': 'Rental Suite',\n",
" 'TVE': 'Entertainment: TV, PVR, AMP',\n",
" 'UTE': 'Utility Room Plug',\n",
" 'WOE': 'Wall Oven',\n",
" }\n",
"\n",
"#name_columns = {'fround_truth': 'Ground '}"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [],
"source": [
"pd.concat(dfs, axis=1).rename(index=FULL_NAME).to_excel('all_results.xls')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Binary file added ProyectoFinal/images/ground_truth_prob_s2k.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ProyectoFinal/images/loss_s2k_reg_0.001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ProyectoFinal/images/loss_s2k_reg_0.01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ProyectoFinal/images/loss_s2k_reg_0.1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ProyectoFinal/images/loss_s2k_reg_1.0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ProyectoFinal/images/loss_s2k_reg_10.0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ProyectoFinal/images/loss_s2k_reg_100.0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ProyectoFinal/images/loss_s2k_restriccion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ProyectoFinal/images/plot_agregado_s2k.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ProyectoFinal/images/plot_agregado_simple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ProyectoFinal/images/plot_desagregado_DWE_s2k.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ProyectoFinal/images/plot_desagregado_FGE_s2k.png
Binary file added ProyectoFinal/images/plot_desagregado_HPE_s2k.png
Binary file added ProyectoFinal/images/prediction_prob_s2k.png
7 changes: 5 additions & 2 deletions ProyectoFinal/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import matplotlib.pyplot as plt
from matplotlib import rcParams

def plot_loss(losses, title=None):
def plot_loss(losses, title=None, ylabel=None):
rcParams['font.style'] = 'normal'
rcParams['font.size'] = 12
rcParams['font.weight'] = 'normal'
Expand All @@ -10,5 +10,8 @@ def plot_loss(losses, title=None):
#plt.ylim((1055476.62*0.96, 1265412.12*1.2))
plt.grid(True)
plt.xlabel('Iteración')
plt.ylabel(r'loss$={||X-DA||_F^2}$')
if ylabel is None:
plt.ylabel(r'loss$={||X-DA||_F^2}$')
else:
plt.ylabel(ylabel)
if title is not None: plt.title(title)

0 comments on commit 9dc64fd

Please sign in to comment.