GAMINet Regression#

Installation

# To install the required package, use the following command:
# !pip install modeva

Authentication

# To get authentication, use the following command: (To get full access please replace the token to your own token)
# from modeva.utils.authenticate import authenticate
# authenticate(auth_code='eaaa4301-b140-484c-8e93-f9f633c8bacb')

Import required modules

from modeva import DataSet
from modeva import TestSuite
from modeva.models import MoGAMINetRegressor

Load and prepare dataset

ds = DataSet()
ds.load(name="BikeSharing")
ds.set_random_split()
ds.set_target("cnt")

ds.scale_numerical(features=("cnt",), method="log1p")
ds.scale_numerical(method="minmax")
ds.preprocess()

Train model#

model = MoGAMINetRegressor(random_state=0)
model.fit(ds.train_x, ds.train_y.ravel())
MoGAMINetRegressor(device='cpu', name='MoGAMINetRegressor')
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.


Basic accuracy analysis#

ts = TestSuite(ds, model)
results = ts.diagnose_accuracy_table()
results.table
MSE MAE R2
train 0.0027 0.0367 0.9475
test 0.0029 0.0376 0.9449
GAP 0.0002 0.0009 -0.0026


Feature importance analysis#

results = ts.interpret_fi()
results.plot()


Local feature importance analysis#

results = ts.interpret_local_fi(sample_index=1, centered=True)
results.plot()


Another sample in train set

results = ts.interpret_local_ei(dataset='train', sample_index=1)
results.plot()


Effects interpretation#

For numerical feature

results = ts.interpret_effects(features="hr")
results.plot()


For categorical feature

results = ts.interpret_effects(features="yr")
results.plot()


For 2 features

results = ts.interpret_effects(features=("atemp", "hr"))
results.plot()


Total running time of the script: (1 minutes 17.886 seconds)

Gallery generated by Sphinx-Gallery