Skip to content

Commit 3fcb4f7

Browse files
committed
VERSION 0.2.0
1 parent cf27fda commit 3fcb4f7

8 files changed

Lines changed: 38 additions & 25 deletions

File tree

MANIFEST.in

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,14 @@ Kriging
146146
import numpy as np
147147
148148
from ezmodel.models.kriging import Kriging
149-
from ezmodel.util.sample_from_func import sine_function
149+
from ezmodel.util.sample_from_func import square_function
150150
151151
model = Kriging(regr="linear",
152152
corr="gauss",
153153
ARD=False)
154154
155155
# create some data to test this model on
156-
X, y, _X, _y = sine_function(100, 20)
156+
X, y, _X, _y = square_function(100, 20)
157157
158158
# let the model fit the data
159159
model.fit(X, y)

docs/github/README.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ezmodel - A common interface for models and model selection
1+
ezmodel - A Common Interface for Models and Model Selection
22
====================================================================
33

44
For more information about our toolbox, users are encouraged to read our documentation.

ezmodel/core/benchmark.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def results(self,
239239

240240
return ret
241241

242-
def statistics(self, metric="mae", vals=['mean', 'std', 'min', 'max', 'median'], sort=None):
242+
def statistics(self, metric="mae", vals=['mean', 'std', 'min', 'max', 'median'], sort_by="mean", ascending=True):
243243
try:
244244
import pandas as pd
245245
except:
@@ -249,8 +249,8 @@ def statistics(self, metric="mae", vals=['mean', 'std', 'min', 'max', 'median'],
249249
tbl = df.groupby(["label"]).agg({metric: vals})
250250
df.groupby(["label"]).agg({metric: vals})
251251

252-
if sort is not None:
253-
tbl = tbl.sort_values((metric, vals[0]), ascending=sort)
252+
if sort_by is not None:
253+
tbl = tbl.sort_values((metric, sort_by), ascending=ascending)
254254

255255
return tbl
256256

ezmodel/usage/models/usage_kriging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
import numpy as np
33

44
from ezmodel.models.kriging import Kriging
5-
from ezmodel.util.sample_from_func import sine_function
5+
from ezmodel.util.sample_from_func import square_function
66

77
model = Kriging(regr="linear",
88
corr="gauss",
99
ARD=False)
1010

1111
# create some data to test this model on
12-
X, y, _X, _y = sine_function(100, 20)
12+
X, y, _X, _y = square_function(100, 20)
1313

1414
# let the model fit the data
1515
model.fit(X, y)

ezmodel/usage/scratch.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
description="Machine Learning, Model, Surrogate, Metamodels, Response Surface",
1818
license='Apache License 2.0',
1919
keywords="model",
20-
install_requires=['numpy>=1.15', "pandas", "scipy", "sklearn", "pydacefit", "pySOT==0.2.3"],
20+
install_requires=['numpy', "pandas", "scipy", "sklearn", "pydacefit", "matplotlib"],
2121
include_package_data=True,
2222
platforms='any',
2323
classifiers=[

tests/scratch.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import numpy as np
2+
3+
import pandas as pd
4+
pd.set_option('display.expand_frame_repr', False)
5+
pd.set_option('max_colwidth', 1000)
6+
7+
from ezmodel.core.benchmark import Benchmark
8+
from ezmodel.core.factory import models_from_clazzes
9+
from ezmodel.models.kriging import Kriging
10+
from ezmodel.models.rbf import RBF
11+
from ezmodel.util.partitioning.crossvalidation import CrossvalidationPartitioning
12+
13+
X = np.random.random((100, 3)) * 2 * np.pi
14+
y = np.sin(X).sum(axis=1)
15+
16+
models = models_from_clazzes(RBF, Kriging)
17+
18+
# set up the benchmark and add the models to be used
19+
benchmark = Benchmark(models, n_threads=4, verbose=True, raise_exception=True)
20+
21+
# create partitions to validate the performance of each model
22+
partitions = CrossvalidationPartitioning(k_folds=5, seed=1).do(X)
23+
24+
# runs the experiment with the specified partitioning
25+
benchmark.do(X, y, partitions=partitions)
26+
27+
# print out the benchmark results
28+
print(benchmark.statistics("mae"))
29+

0 commit comments

Comments
 (0)