bonjour je suis bloque dans ce programme je n'arrive pas a trouver comment predire un string avec le perceptron
Code python : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import numpy as np import pandas as pd from sklearn.linear_model import Perceptron X = dataframe rockyou res = [] tes = [] for i in X.index : res.append(str(X["password"][i])) # for ele in res : # tes = ' '.join('{0:08b}'.format(ord(x), 'b') for x in ele) y_test = 'test' y_testconvert = [' '.join('{0:08b}'.format(ord(x), 'b') for x in y_test)] print(y_testconvert) # printing result print("The ascii list is : " + str(res)) y = (X["password"] == y_testconvert) par_clf = Perceptron() par_clf.fit(X,y) y_pred = par_clf.predict(X)
Partager