update notebook tests for new notebooks (#1066)

This commit is contained in:
Ilya Matiach 2021-12-06 20:53:39 -05:00 коммит произвёл GitHub
Родитель 94abfcb88b
Коммит bfc9b8e47e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 61 добавлений и 1482 удалений

Просмотреть файл

@ -105,7 +105,7 @@ export interface IWhatIfCounterfactualsData {
}
export enum RAINotebookNames {
"ClassificationModelAssessment" = "responsibleaitoolbox-classification-model-assessment.py",
"RegressionDecisionMaking" = "responsibleaitoolbox-regression-decision-making.py",
"RegressionModelAssessment" = "responsibleaitoolbox-regression-model-assessment.py"
"ClassificationModelAssessment" = "responsibleaidashboard-census-classification-model-debugging.py",
"RegressionDecisionMaking" = "responsibleaidashboard-diabetes-decision-making.py",
"RegressionModelAssessment" = "responsibleaidashboard-diabetes-regression-model-debugging.py"
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -122,7 +122,7 @@
" print(pipe_cfg['cat_cols'])\n",
" return X, feat_pipe, features, classes\n",
"\n",
"outdirname = 'erroranalysis.12.3.20'\n",
"outdirname = 'responsibleai.12.6.21'\n",
"try:\n",
" from urllib import urlretrieve\n",
"except ImportError:\n",

Просмотреть файл

@ -53,7 +53,8 @@
"import pandas as pd\n",
"\n",
"from sklearn.model_selection import train_test_split\n",
"from lightgbm import LGBMClassifier"
"from lightgbm import LGBMClassifier\n",
"import zipfile"
]
},
{
@ -106,6 +107,17 @@
"\n",
"target_feature = 'Sold_HigherThan_Median'\n",
"categorical_features = []\n",
"\n",
"outdirname = 'responsibleai.12.6.21'\n",
"try:\n",
" from urllib import urlretrieve\n",
"except ImportError:\n",
" from urllib.request import urlretrieve\n",
"zipfilename = outdirname + '.zip'\n",
"urlretrieve('https://publictestdatasets.blob.core.windows.net/data/' + zipfilename, zipfilename)\n",
"with zipfile.ZipFile(zipfilename, 'r') as unzip:\n",
" unzip.extractall('.')\n",
"\n",
"all_data = pd.read_csv('apartments-train.csv')\n",
"all_data = all_data.drop(['SalePrice','SalePriceK'], axis=1)\n",
"X, y = split_label(all_data, target_feature)\n",

Просмотреть файл

@ -41,7 +41,8 @@
"source": [
"import sklearn\n",
"import pandas as pd\n",
"from sklearn.model_selection import train_test_split"
"from sklearn.model_selection import train_test_split\n",
"import zipfile"
]
},
{
@ -94,6 +95,17 @@
"\n",
"target_feature = 'SalePriceK'\n",
"categorical_features = []\n",
"\n",
"outdirname = 'responsibleai.12.6.21'\n",
"try:\n",
" from urllib import urlretrieve\n",
"except ImportError:\n",
" from urllib.request import urlretrieve\n",
"zipfilename = outdirname + '.zip'\n",
"urlretrieve('https://publictestdatasets.blob.core.windows.net/data/' + zipfilename, zipfilename)\n",
"with zipfile.ZipFile(zipfilename, 'r') as unzip:\n",
" unzip.extractall('.')\n",
"\n",
"all_data = pd.read_csv('apartments-train.csv')\n",
"all_data = all_data.drop(['Sold_HigherThan_Median','SalePrice'], axis=1)\n",
"X, y = split_label(all_data, target_feature)\n",

Просмотреть файл

@ -16,7 +16,7 @@ RACE_GROUP_SIZES_ADULT = {
'Other': 406
}
INDIVIDUAL_DASHBOARDS = 'individual-dashboards/'
RESPONSIBLEAITOOLBOX_DASHBOARD = 'responsibleaitoolbox-dashboard/'
RESPONSIBLEAIDASHBOARD = 'responsibleaidashboard/'
ERROR_ANALYSIS_DASHBOARD = INDIVIDUAL_DASHBOARDS + 'erroranalysis-dashboard/'
EXPLANATION_DASHBOARD = INDIVIDUAL_DASHBOARDS + 'explanation-dashboard/'
FAIRNESS_DASHBOARD = INDIVIDUAL_DASHBOARDS + 'fairness-dashboard/'
@ -204,27 +204,45 @@ def test_erroranalysis_dashboard_boston_housing():
@pytest.mark.notebooks
def test_responsibleaitoolbox_classification_model_assessment():
nb_path = RESPONSIBLEAITOOLBOX_DASHBOARD
nb_name = "responsibleaitoolbox-classification-model-assessment"
def test_responsibleaidashboard_census_classification_model_debugging():
nb_path = RESPONSIBLEAIDASHBOARD
nb_name = "responsibleaidashboard-census-classification-model-debugging"
test_values = {}
assay_one_notebook(nb_path, nb_name, test_values)
@pytest.mark.notebooks
def test_responsibleaitoolbox_regression_model_assessment():
nb_path = RESPONSIBLEAITOOLBOX_DASHBOARD
nb_name = "responsibleaitoolbox-regression-model-assessment"
def test_responsibleaidashboard_diabetes_decision_making():
nb_path = RESPONSIBLEAIDASHBOARD
nb_name = "responsibleaidashboard-diabetes-decision-making"
test_values = {}
assay_one_notebook(nb_path, nb_name, test_values)
@pytest.mark.notebooks
def test_responsibleaitoolbox_regression_decision_making():
nb_path = RESPONSIBLEAITOOLBOX_DASHBOARD
nb_name = "responsibleaitoolbox-regression-decision-making"
def test_responsibleaidashboard_diabetes_regression_model_debugging():
nb_path = RESPONSIBLEAIDASHBOARD
nb_name = "responsibleaidashboard-diabetes-regression-model-debugging"
test_values = {}
assay_one_notebook(nb_path, nb_name, test_values)
@pytest.mark.notebooks
def test_responsibleaidashboard_housing_classification_model_debugging():
nb_path = RESPONSIBLEAIDASHBOARD
nb_name = "responsibleaidashboard-housing-classification-model-debugging"
test_values = {}
assay_one_notebook(nb_path, nb_name, test_values)
@pytest.mark.notebooks
def test_responsibleaidashboard_housing_decision_making():
nb_path = RESPONSIBLEAIDASHBOARD
nb_name = "responsibleaidashboard-housing-decision-making"
test_values = {}
assay_one_notebook(nb_path, nb_name, test_values)

Просмотреть файл

@ -4,11 +4,9 @@ const path = require("path");
const _ = require("lodash");
const commander = require("commander");
const baseDir = path.join(
__dirname,
"../notebooks/responsibleaitoolbox-dashboard"
);
const filePrefix = "responsibleaitoolbox";
const baseDir = path.join(__dirname, "../notebooks/responsibleaidashboard");
const filePrefix =
"responsibleaidashboard-census-classification-model-debugging";
const hostReg = /^ResponsibleAI started at (http:\/\/localhost:\d+)$/m;
const timeout = 3600;