python 1e-5 是什么意思

x = 1e-4
print x
会输出0.0001
如果你想要e-5则需要写成
1e-5
它会输出1e-05,不是他没有变化,而是它自动将0.00001转换成1e-05
你可以试一下x = 0.00001
print x
输出一回事1e-05


#encoding=utf8
import os
import pandas as pd
if os.path.exists('./step2/result.csv'):
    os.remove('./step2/result.csv')
    
#********* Begin *********#
#获取训练数据
train_data = pd.read_csv('./step2/train_data.csv')
#获取训练标签
train_label = pd.read_csv('./step2/train_label.csv')
train_label = train_label['target']
#获取测试数据
test_data = pd.read_csv('./step2/test_data.csv')

from sklearn.neural_network import MLPClassifier
mlp = MLPClassifier(solver='lbfgs',max_iter =10,
           alpha=1e-5,hidden_layer_sizes=(10,5))
mlp.fit(train_data, train_label)
results = mlp.predict(test_data)

df = pd.DataFrame(results,columns =['result'])
df.to_csv("./step2/result.csv", encoding="utf-8-sig", mode="a", header=True, index=False)
#********* End *********#

#encoding=utf8
import os
import pandas as pd
if os.path.exists('./step2/result.csv'):
    os.remove('./step2/result.csv')
    
#********* Begin *********#
#获取训练数据
train_data = pd.read_csv('./step2/train_data.csv')
#获取训练标签
train_label = pd.read_csv('./step2/train_label.csv')
train_label = train_label['target']
#获取测试数据
test_data = pd.read_csv('./step2/test_data.csv')

from sklearn.neural_network import MLPClassifier
mlp = MLPClassifier(solver='lbfgs',max_iter =10,
           alpha=0.00001,hidden_layer_sizes=(10,5))
mlp.fit(train_data, train_label)
results = mlp.predict(test_data)

df = pd.DataFrame(results,columns =['result'])
df.to_csv("./step2/result.csv", encoding="utf-8-sig", mode="a", header=True, index=False)
#********* End *********#

上下两个结果相同

你可能感兴趣的:(Python,python,人工智能,机器学习)