91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

此文件基于github中ahmedfgad的NeuralGenetic文件,若可以訪問則直接訪問,否則謝謝老板的積分。 文章內(nèi)容詳情:此文件沒有用TensorFlow,沒有用pytorch,只需安裝相對應的包即可使用。文章中的適應度是根據(jù)預測出來對應的類的正確的個數(shù)占總個數(shù)比例決定。通過設計自己的適應度要求即可滿足上述情況。

資源截圖

代碼片段和文件信息

import?numpy

def?sigmoid(inpt):
????return?1.0/(1.0+numpy.exp(-1*inpt))

def?relu(inpt):
????result?=?inpt
????result[inpt<0]?=?0
????return?result

def?predict_outputs(weights_mat?data_inputs?data_outputs?activation=“relu“):
????predictions?=?numpy.zeros(shape=(data_inputs.shape[0]))
????for?sample_idx?in?range(data_inputs.shape[0]):
????????r1?=?data_inputs[sample_idx?:]
????????for?curr_weights?in?weights_mat:
????????????r1?=?numpy.matmul(r1?curr_weights)
????????????if?activation?==?“relu“:
????????????????r1?=?relu(r1)
????????????elif?activation?==?“sigmoid“:
????????????????r1?=?sigmoid(r1)
????????predicted_label?=?numpy.where(r1?==?numpy.max(r1))[0][0]
????????predictions[sample_idx]?=?predicted_label
????correct_predictions?=?numpy.where(predictions?==?data_outputs)[0].size
????accuracy?=?(correct_predictions/data_outputs.size)*100
????return?accuracy?predictions
????
def?fitness(weights_mat?data_inputs?data_outputs?activation=“relu“):
????accuracy?=?numpy.empty(shape=(weights_mat.shape[0]))
????for?sol_idx?in?range(weights_mat.shape[0]):
????????curr_sol_mat?=?weights_mat[sol_idx?:]
????????accuracy[sol_idx]?_?=?predict_outputs(curr_sol_mat?data_inputs?data_outputs?activation=activation)
????return?accuracy


?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

????.......??????1288??2020-06-02?04:42??Tutorial-Project\ANN.py

????.......???5650722??2020-06-02?04:42??Tutorial-Project\dataset_features.pkl

?????文件???????3965??2020-07-31?09:33??Tutorial-Project\Example_GA_ANN.py

????.......??????3230??2020-06-02?04:42??Tutorial-Project\ga.py

????.......?????15855??2020-06-02?04:42??Tutorial-Project\outputs.pkl

????.......??????4419??2020-06-02?04:42??Tutorial-Project\README.md

?????文件????1571751??2020-08-01?09:06??Tutorial-Project\weights_20_iterations_10%_mutation.pkl

?????文件??????????0??2020-07-31?09:25??Tutorial-Project\__init__.py

?????文件???????1339??2020-07-31?09:33??Tutorial-Project\__pycache__\ANN.cpython-37.pyc

?????文件???????2123??2020-07-31?09:33??Tutorial-Project\__pycache__\ga.cpython-37.pyc

?????目錄??????????0??2020-07-31?09:33??Tutorial-Project\__pycache__

?????目錄??????????0??2020-07-31?09:35??Tutorial-Project

-----------?---------??----------?-----??----

??????????????7254692????????????????????12


評論

共有 條評論

相關(guān)資源