Skip to content

Commit

Permalink
VERSION 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
blankjul committed Apr 1, 2022
1 parent cf27fda commit 3fcb4f7
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 25 deletions.
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ Kriging
import numpy as np
from ezmodel.models.kriging import Kriging
from ezmodel.util.sample_from_func import sine_function
from ezmodel.util.sample_from_func import square_function
model = Kriging(regr="linear",
corr="gauss",
ARD=False)
# create some data to test this model on
X, y, _X, _y = sine_function(100, 20)
X, y, _X, _y = square_function(100, 20)
# let the model fit the data
model.fit(X, y)
Expand Down
2 changes: 1 addition & 1 deletion docs/github/README.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ezmodel - A common interface for models and model selection
ezmodel - A Common Interface for Models and Model Selection
====================================================================

For more information about our toolbox, users are encouraged to read our documentation.
Expand Down
6 changes: 3 additions & 3 deletions ezmodel/core/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def results(self,

return ret

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

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

return tbl

Expand Down
4 changes: 2 additions & 2 deletions ezmodel/usage/models/usage_kriging.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import numpy as np

from ezmodel.models.kriging import Kriging
from ezmodel.util.sample_from_func import sine_function
from ezmodel.util.sample_from_func import square_function

model = Kriging(regr="linear",
corr="gauss",
ARD=False)

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

# let the model fit the data
model.fit(X, y)
Expand Down
15 changes: 0 additions & 15 deletions ezmodel/usage/scratch.py

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
description="Machine Learning, Model, Surrogate, Metamodels, Response Surface",
license='Apache License 2.0',
keywords="model",
install_requires=['numpy>=1.15', "pandas", "scipy", "sklearn", "pydacefit", "pySOT==0.2.3"],
install_requires=['numpy', "pandas", "scipy", "sklearn", "pydacefit", "matplotlib"],
include_package_data=True,
platforms='any',
classifiers=[
Expand Down
29 changes: 29 additions & 0 deletions tests/scratch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import numpy as np

import pandas as pd
pd.set_option('display.expand_frame_repr', False)
pd.set_option('max_colwidth', 1000)

from ezmodel.core.benchmark import Benchmark
from ezmodel.core.factory import models_from_clazzes
from ezmodel.models.kriging import Kriging
from ezmodel.models.rbf import RBF
from ezmodel.util.partitioning.crossvalidation import CrossvalidationPartitioning

X = np.random.random((100, 3)) * 2 * np.pi
y = np.sin(X).sum(axis=1)

models = models_from_clazzes(RBF, Kriging)

# set up the benchmark and add the models to be used
benchmark = Benchmark(models, n_threads=4, verbose=True, raise_exception=True)

# create partitions to validate the performance of each model
partitions = CrossvalidationPartitioning(k_folds=5, seed=1).do(X)

# runs the experiment with the specified partitioning
benchmark.do(X, y, partitions=partitions)

# print out the benchmark results
print(benchmark.statistics("mae"))

0 comments on commit 3fcb4f7

Please sign in to comment.