Пример #1
0
    def setUp(self):
        X, y = make_blobs(n_samples=100, n_features=2, centers=2,
                          cluster_std=2, random_state=20)

        dpp = DiProPerm(B=1000, separation_stats=['md', 't', 'auc'], clf='md')
        dpp.fit(X, y)

        self.dpp = dpp
        self.X = X
        self.y = y
Пример #2
0
    def test_custom_classifier(self):
        """
        User provided custom classifier.
        """

        clf = get_training_fun(clf=LinearSVC(max_iter=10000),
                               param_grid={'C': [.0001, .001, .01, 1, 10, 100]},
                               metric='roc_auc', n_splits=5)

        dpp = DiProPerm(B=1000, clf=clf)
        dpp.fit(self.X, self.y)

        self.assertTrue(hasattr(dpp, 'test_stats_'))
Пример #3
0
    csvReader = csv.reader(csvDataFile)
    for row in csvReader:
        y.append(row[1])

y = np.array(y)
X = np.array(X)
y = y[1:]
X = X[1:, 1:]
y = y.astype(int)
X = X.astype(float)

#X = pd.read_csv("full_playtime_data.csv", index_col=None, header=0, dtype = 'a')
#y = pd.read_csv("full_playtime_response.csv", index_col=None, header=0, dtype = 'a')

# DiProPerm with mean difference classifier, mean difference summary
# statistic, and 1000 permutation samples.
dpp = DiProPerm(B=1000, separation_stats=['md', 't', 'auc'], clf='md')
dpp.fit(X, y)

print(dpp.test_stats_['md'])

plt.figure(figsize=[12, 5])
# show histogram of separation statistics
plt.subplot(1, 2, 1)
dpp.plot_perm_sep_stats(stat='md')

# the observed scores
plt.subplot(1, 2, 2)
dpp.plot_observed_scores()
plt.title("all_distances")
plt.show()