Skip to content

Commit

Permalink
test learning curve
Browse files Browse the repository at this point in the history
  • Loading branch information
HyunjunA committed Dec 5, 2022
1 parent b4e722d commit 7cb5587
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions machine/learn/skl_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
from sklearn.preprocessing import OneHotEncoder, OrdinalEncoder, LabelEncoder
from sklearn.model_selection import GridSearchCV, cross_validate, StratifiedKFold, KFold
from sklearn.metrics import SCORERS, roc_curve, auc, make_scorer, confusion_matrix

from sklearn.manifold import TSNE
from sklearn.model_selection import learning_curve
from sklearn import decomposition

import itertools
import json
import os
Expand All @@ -46,10 +51,12 @@
import numpy as np
import pandas as pd
import matplotlib as mpl
from sklearn import decomposition

import matplotlib.colors as mcolors
from matplotlib.patches import Patch
from sklearn.manifold import TSNE




mpl.use('Agg')

Expand Down Expand Up @@ -370,7 +377,7 @@ def generate_results(model, input_data,
model = clf.best_estimator_
else:
print("param_grid else")
# plot_learning_curve(tmpdir,_id, model,features,target,cv,return_times=True)
plot_learning_curve(tmpdir,_id, model,features,target,cv,return_times=True)
model.fit(features, target)


Expand Down Expand Up @@ -1087,9 +1094,7 @@ def plot_imp_score(tmpdir, _id, coefs, feature_names, imp_score_type):

def plot_learning_curve(tmpdir,_id,model,features,target,cv,return_times=True):

from sklearn.model_selection import learning_curve
from matplotlib import pyplot as plt
import numpy as np



features = np.array(features)
Expand Down

0 comments on commit 7cb5587

Please sign in to comment.