def click(): output.delete(0.0, tk.END) input_var = prediction(var) output.insert(tk.END, input_var)
# split into a training and testing set X_train, X_test, y_train, y_test = split_data(X, y) # compute ICA n_components = 150 ica, eigenfaces = dimensionality_reduction_ICA(n_components, X_train, height, width) X_train_ica, X_test_ica = train_text_transform_Model(ica, X_train, X_test) # Training a SVM classification model clf = classification_svc(X_train_ica, y_train) # Quantitative evaluation of the model quality on the test set y_pred = prediction(clf, X_test_ica) # printing classification report print_report(y_test, y_pred, target_names, n_classes) # printing images prediction_titles = [ title(y_pred, y_test, target_names, i) for i in range(y_pred.shape[0]) ] plot_images(X_test, prediction_titles, height, width) # plot eigenfaces eigenface_titles = ["eigenface %d" % i for i in range(eigenfaces.shape[0])] plot_images(eigenfaces, eigenface_titles, height, width)
def getAccuracy(): accuracy = prediction() return render_template('wordcloud.html', name=accuracy, url='static/images/nlp.png')
dataset) # split into a training and testing set X_train, X_test, y_train, y_test = split_data(X, y) # compute LDA n_components = 150 lda, pca = dimensionality_reduction_LDA(n_components, X_train, y_train) X_train_lda, X_test_lda = train_text_transform_LDA(lda, pca, X_train, X_test) # Training a SVM classification model clf = classification_svc(X_train_lda, y_train) # Quantitative evaluation of the model quality on the test set y_pred = prediction(clf, X_test_lda) # printing classification report print_report(y_test, y_pred, target_names, n_classes) # printing images prediction_titles = [ title(y_pred, y_test, target_names, i) for i in range(y_pred.shape[0]) ] plot_images(X_test, prediction_titles, height, width) # plot fisherfaces fisherface_titles = ["fisherface %d" % i for i in range(4)] plot_images_lda(pca, lda, fisherface_titles, height, width)
# split into a training and testing set X_train, X_test, y_train, y_test = split_data(X, y) # compute NMF n_components = 150 nmf, eigenfaces = dimensionality_reduction_NMF(n_components, X_train, height, width) X_train_nmf, X_test_nmf = train_text_transform_Model(nmf, X_train, X_test) # Training a SVM classification model clf = classification_svc(X_train_nmf, y_train) # Quantitative evaluation of the model quality on the test set y_pred = prediction(clf, X_test_nmf) # printing classification report print_report(y_test, y_pred, target_names, n_classes) # printing images prediction_titles = [ title(y_pred, y_test, target_names, i) for i in range(y_pred.shape[0]) ] plot_images(X_test, prediction_titles, height, width) # plot eigenfaces eigenface_titles = ["eigenface %d" % i for i in range(eigenfaces.shape[0])] plot_images(eigenfaces, eigenface_titles, height, width)