Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os import path | |
import jieba | |
import jieba.analyse as ja | |
pip install jieba | |
from gensim.test.utils import common_texts, get_tmpfile | |
with open('../JJ/lyric.txt', 'r') as handle: | |
print(handle) | |
for line in handle: | |
tags = ja.extract_tags(line, topK=10, withWeight=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DecisionTreeClassifier predict | |
from sklearn.metrics import accuracy_score | |
x_test = dev_test.iloc[:,0:46] | |
x_test_1 = x_test.drop(['Client_MYOL_Statut'], axis=1, inplace=False) | |
x_t1_m = x_test_1.as_matrix() | |
test_pred = clf.predict(x_t1_m) | |
y_test = dev_test.Client_Abo_1819.as_matrix() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#use Silhouette Analysis | |
from sklearn.metrics import silhouette_samples, silhouette_score | |
range_n_clusters = [2, 3, 4, 5, 6,7,8,9] | |
for n_clusters in range_n_clusters: | |
kmeans = KMeans(n_clusters=n_clusters, random_state=0).fit(data_std) | |
labels = kmeans.labels_ | |
silhouette_avg = silhouette_score(data_std, labels) | |
print("For n_clusters =", n_clusters, | |
"The average silhouette_score is :", silhouette_avg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
import sys | |
def get_size(total_size, percentage, mean): | |
size_train = int(percentage * total_size / 100) | |
size_client_abo = [int(size_train * (1 - mean)), int(size_train * mean)] | |
return size_client_abo | |
def populate(data, indexs, sizes): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#1 Retrain the linear and polynomial models | |
import pandas as pd | |
from sklearn.linear_model import LinearRegression | |
from sklearn import metrics | |
from sklearn.metrics import mean_squared_error | |
from sklearn.preprocessing import PolynomialFeatures | |
from sklearn.metrics import r2_score | |
X_train, X_test, y_train, y_test = train_test_split( | |
X, Y, test_size=0.3, random_state=0) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder