Ennosigaeon / xautoml

XAutoML: A Visual Analytics Tool for Understanding and Validating Automated Machine Learning
BSD 3-Clause "New" or "Revised" License
32 stars 7 forks source link

Can't open the visual interface #5

Closed SeibertronSS closed 1 year ago

SeibertronSS commented 1 year ago

Referring to the example, I trained a model with my own data, but I can't open the visualization in Jupyter. My code is

import gc
import numpy as np
import pandas as pd
from scipy.stats import uniform, randint
from sklearn.model_selection import RandomizedSearchCV
from sklearn.ensemble import RandomForestClassifier
from sklearn.feature_selection import SelectKBest
from sklearn.pipeline import Pipeline
from sklearn.compose import ColumnTransformer, make_column_selector
from sklearn.preprocessing import OrdinalEncoder, MinMaxScaler
data = pd.read_csv('./train.csv')
y_col = 'Covertype'
y_train = data[y_col]
X_train = data.drop([y_col],axis=1)
del data; gc.collect()
# Specify search space
param_distribution = {
    'k_best__k': randint(1, X_train.shape[1]),
    'clf__min_samples_split': uniform(loc=0, scale=0.5),
    'clf__max_features': uniform(loc=0, scale=1.0),
    'clf__criterion': ['gini', 'entropy']
}

# Creating the classifier
pipeline = Pipeline(steps=[
    ('k_best', SelectKBest()),
    ('clf', RandomForestClassifier())
])

random_search = RandomizedSearchCV(pipeline, param_distributions=param_distribution, cv=3, scoring='accuracy',
                                   n_iter=200, random_state=0)
random_search.fit(X_train, y_train)
from xautoml.main import XAutoML
from xautoml.adapter import import_sklearn
# from xautoml.util.datasets import openml_task

# X_test, y_test = openml_task(31, 0, test=True)

rh = import_sklearn(random_search)
main = XAutoML(rh, X_train, y_train)
main

I just get

<xautoml.main.XAutoML at 0x7fb42208fbb0>
SeibertronSS commented 1 year ago

I started the relevant jupyter component and installed swig.

(kf)[xxx@cpu-11-71-1-190 python_test]jupyter labextension list
JupyterLab v3.5.0
/export/home/xxx/miniconda3/envs/kf/share/jupyter/labextensions
        jupyterlab_pygments v0.2.2 enabled OK (python, jupyterlab_pygments)
        xautoml v0.1.0 enabled OK (python, xautoml)

(kf) [xxx@cpu-11-71-1-190 python_test]jupyter server extension list
Config dir: /export/home/xxx/.jupyter

Config dir: /export/home/xxx/miniconda3/envs/kf/etc/jupyter
    jupyterlab enabled
    - Validating jupyterlab...
      jupyterlab 3.5.0 OK
    nbclassic enabled
    - Validating nbclassic...
      nbclassic 0.4.8 OK
    notebook_shim enabled
    - Validating notebook_shim...
      notebook_shim  OK
    xautoml enabled
    - Validating xautoml...
      xautoml 0.1.0 OK
SeibertronSS commented 1 year ago

I found the problem. Not available run the code using jupyter in vscode.

Ennosigaeon commented 1 year ago

Hey, sorry for being late. The extension requires full Javascript support. Not sure if VSCode even provides JS, I only tested it in a browser.

SeibertronSS commented 1 year ago

It's ok. I run it successfully in a browser.