Skip to content
This repository has been archived by the owner on Nov 17, 2019. It is now read-only.

Commit

Permalink
Agrego ejemplos de uso
Browse files Browse the repository at this point in the history
  • Loading branch information
leferrad committed Dec 8, 2016
1 parent 7606c01 commit 76d1f05
Show file tree
Hide file tree
Showing 2 changed files with 311 additions and 11 deletions.
17 changes: 6 additions & 11 deletions examples/demo_plants.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from learninspy.core.model import NeuralNetwork, NetworkParameters
from learninspy.core.optimization import OptimizerParameters
from learninspy.core.stops import criterion
from learninspy.utils.data import LocalLabeledDataSet, StandardScaler, load_ccpp
from learninspy.utils.data import LocalLabeledDataSet, load_ccpp
from learninspy.utils.evaluation import RegressionMetrics
from learninspy.utils.plots import plot_fitting
from learninspy.utils.fileio import get_logger
Expand All @@ -18,12 +18,6 @@

logger = get_logger(name='learninspy-demo_ccpp')

# Aca conviene hacer de demo:
# *Examinar diferencias en resultados con diferentes funciones de consenso
# *Explorar criterios de corte
# ** MaxIterations de 5 a 20 cambia mucho el resultado final (mejora)


# -- 1.a) Carga de datos

logger.info("Cargando datos de Combined Cycle Power Plant ...")
Expand Down Expand Up @@ -53,13 +47,13 @@
local_stops = [criterion['MaxIterations'](30),
criterion['AchieveTolerance'](0.95, key='hits')]

global_stops = [criterion['MaxIterations'](50),
global_stops = [criterion['MaxIterations'](20),
criterion['AchieveTolerance'](0.95, key='hits')]

options = {'step-rate': 1.0, 'decay': 0.995, 'momentum': 0.3, 'offset': 1e-8}
options = {'step-rate': 1.0, 'decay': 0.995, 'momentum': 0.7, 'offset': 1e-8}

optimizer_params = OptimizerParameters(algorithm='Adadelta', stops=local_stops, options=options,
merge_criter='avg', merge_goal='hits')
merge_criter='w_avg', merge_goal='cost')

logger.info("Optimizacion utilizada: %s", os.linesep+str(optimizer_params))
logger.info("Configuracion usada: %s", os.linesep+str(net_params))
Expand All @@ -69,7 +63,7 @@
neural_net = NeuralNetwork(net_params)

logger.info("Entrenando red neuronal ...")
hits_valid = neural_net.fit(train, valid, valid_iters=5, mini_batch=50, parallelism=4,
hits_valid = neural_net.fit(train, valid, valid_iters=1, mini_batch=20, parallelism=0,
stops=global_stops, optimizer_params=optimizer_params, measure='R2',
keep_best=True, reproducible=False)
hits_test, predict = neural_net.evaluate(test, predictions=True)
Expand All @@ -84,6 +78,7 @@
print "MSE: ", metrics.mse()
print "RMSE: ", metrics.rmse()
print "MAE: ", metrics.mae()
print "RMAE: ", metrics.rmae()
print "R-cuadrado: ", metrics.r2()
print "Explained Variance: ", metrics.explained_variance()
print zip(predict, labels)[:10]
Expand Down
305 changes: 305 additions & 0 deletions examples/notebooks/mnist_learninspy_ae.ipynb

Large diffs are not rendered by default.

0 comments on commit 76d1f05

Please sign in to comment.