ºÃÎĵµ - רҵÎÄÊéд×÷·¶ÎÄ·þÎñ×ÊÁÏ·ÖÏíÍøÕ¾

»úÆ÷ѧϰÉñ¾­ÍøÂçËã·¨

ÓÉ ÌìÏ ·ÖÏí ʱ¼ä£º ¼ÓÈëÊÕ²Ø ÎÒҪͶ¸å µãÔÞ

¡¶È˹¤ÖÇÄÜÓë»úÆ÷ѧϰ¡·

ʵÑ鱨¸æ

Ä꼶__xxxx__________ רҵ________xxxxxx__________ ѧºÅ____________631507xxxx___________ ÐÕÃû_____________gllh________________

ÈÕÆÚ___________2024-5-25__

ʵÑéÆßÉñ¾­ÍøÂçËã·¨

Ò»¡¢ÊµÑéÄ¿µÄ

1¡¢ÒªÇóÕÆÎÕÉñ¾­ÍøÂçËã·¨µÄ»ù±¾Ô­Àí¡¢Á˽âÉñ¾­ÍøÂçËã·¨µÄÖ´Ðйý³Ì¡£ 2¡¢ÔÚ´Ë»ù´¡ÉÏ£¬ÀûÓöà²ãÉñ¾­ÍøÂçËã·¨¶Ô¸ø¶¨Ñù±¾Êý¾ÝʵÏÖ·ÖÀà¡£

ʵÑéÀàÐÍ£ºÑéÖ¤ÐÔ ¼Æ»®¿Î¼ä£º2ѧʱ

¶þ¡¢ÊµÑéÄÚÈÝ

1¡¢Á˽âÉñ¾­ÍøÂçËã·¨µÄÍøÂç½á¹¹ 2¡¢Á˽âÉñ¾­ÍøÂçµÄ·´Ïò´«²¥¹ý³Ì£»

3¡¢¶Ô¸ø¶¨Ñù±¾Êý¾ÝÑ¡ÔñºÏÊʵÄÍøÂç²ãÊýºÍÉñ¾­Ôª¸öÊýʵÏÖ·ÖÀà¹ý³Ì£»

Èý¡¢ÊµÑé²½Öè

1¡¢Êý¾Ý¼¯¶ÁÈë

±¾ÊµÑéÑ¡ÓÃÄÐÅ®ÉúÉí¸ßÌåÖØÊý¾Ý¼¯£º

ÔÚÊý¾Ý¼¯Öн«Å®Éú»®·ÖΪ1£¬ÄÐÉú»®·ÖΪ2£¬Èç½ØͼËùʾ

sex = pd.read_csv('fafa.csv', names = [\sex.head()

sex.describe().transpose() sex.shape

2¡¢Êý¾ÝÔ¤´¦Àí£¬¸ù¾ÝÐèÒª½øÐбê×¼»¯£¬¹éÒ»»¯´¦Àí X = sex.drop('devided',axis=1) y = sex['devided']

3¡¢½«Êý¾Ý¼¯»®·ÖΪѵÁ·¼¯Óë²âÊÔ¼¯

X_train, X_test, y_train, y_test = train_test_split(X, y) scaler = StandardScaler() scaler.fit(X_train) 4¡¢ÀûÓÃѵÁ·Êý¾Ý¹¹½¨Ä£ÐÍ

mlp = MLPClassifier(hidden_layer_sizes=(20,51,51),max_iter=5000) mlp.fit(X_train,y_train) 5¡¢ÓòâÊÔÊý¾ÝÆÀ¼ÛÄ£Ð͵ÄÐÔÄÜ

predictions = mlp.predict(X_test)

×Ü´úÂ룺

import pandas as pd

from sklearn.preprocessing import StandardScaler from sklearn.neural_network import MLPClassifier from sklearn.model_selection import train_test_split

from sklearn.metrics import classification_report,confusion_matrix

def readdata(data):

sex = pd.read_csv(data, names = [\ sex.head()

sex.describe().transpose()

sex.shape

X = sex.drop('devided',axis=1) y = sex['devided']

X_train, X_test, y_train, y_test = train_test_split(X, y) scaler = StandardScaler() scaler.fit(X_train)

X_train = scaler.transform(X_train) X_test = scaler.transform(X_test)

mlp = MLPClassifier(hidden_layer_sizes=(55, 55, 55),max_iter=5000) mlp.fit(X_train,y_train)

predictions = mlp.predict(X_test)

print(confusion_matrix(y_test,predictions)) print(classification_report(y_test,predictions))

print(len(mlp.coefs_)) print(len(mlp.coefs_[0])) print(len(mlp.intercepts_[0]))

if __name__ =='__main__': file='fafa.csv' readdata(file)

ʵÑé½á¹û£º

ËÄ¡¢ÊµÑé½á¹û·ÖÎö ʵÑéµÃ³öÈçϽá¹û£º

ÔÚʵÑéÖн«×î´óµü´ú´ÎÊýÉèΪ5000£¬

½ÓÏÂÀ´ÎÒÃÇ´´½¨Ò»¸öÄ£Ð͵ÄʵÀý£¬¿ÉÒÔ×Ô¶¨ÒåºÜ¶à²ÎÊý£¬Ö»¶¨Òå hidden_layer_sizes ²ÎÊý¡£´Ë²ÎÊý´«ÈëµÄÊÇÒ»¸öÔª×飬±íʾ¼Æ»®ÔÚÿ¸ö²ãµÄÉñ¾­ÔªÊýÁ¿£¬ÆäÖÐÔª×éÖеĵÚ55¸öÔªËرíʾ MLP Ä£Ð͵Ú55²ãÖеÄÉñ¾­ÔªÊýÁ¿¡£Óкܶà²ÎÊý¿É¹©Ñ¡Ôñ£¬µ«ÊÇΪÁ˼òµ¥Æð¼û£¬ÎÒÃǽ«Ñ¡Ôñ¾ßÓÐÏàͬÊýÁ¿Éñ¾­ÔªµÄ2²ãÉñ¾­ÍøÂ磬ÿ²ãµÄÉñ¾­ÔªÊýÁ¿ÓëÊý¾ÝµÄÌØÕ÷ÊýÏàͬ£¨55£©£¬²¢½«×î´óµü´ú´ÎÊýÉèÖÃΪ 5000´Î¡£ ¼´£º

mlp = MLPClassifier(hidden_layer_sizes=(55,55,55),max_iter=5000)

[[30 10] [ 2 40]]

precision recall f1-score support

»úÆ÷ѧϰÉñ¾­ÍøÂçËã·¨

¡¶È˹¤ÖÇÄÜÓë»úÆ÷ѧϰ¡·ÊµÑ鱨¸æÄ꼶__xxxx__________רҵ________xxxxxx__________ѧºÅ____________631507xxxx___________ÐÕÃû_____________gllh________________ÈÕÆÚ______
ÍƼö¶È£º
µã»÷ÏÂÔØÎĵµÎĵµÎªdoc¸ñʽ
95tqw5nwmi52amw9lhr375cln2z0an008gv
ÁìÈ¡¸£Àû

΢ÐÅɨÂëÁìÈ¡¸£Àû

΢ÐÅɨÂë·ÖÏí