What is the format of training data in pyfann?

淺唱寂寞╮ 提交于 2019-12-01 05:27:38

问题


What is the format of thraining data in pyfann? Concretely I would like to use the init_weight function of pyfann, but it does not take a range, but finds the range from traning data. Therefore I would like to create a small fake dataset, which has the lowest and the highes value of what can be expected in the programm.


回答1:


Frist Line, 3 arguments: number of data to train, number of inputs, number of outputs from there, goes one line of inputs and one of outputs e.g. (AND logic matrix):

4 2 1    
1 1    
1    
0 1    
0    
0 0    
0    
1 0    
0  

Above:

  • 4 datas to train:

    1 AND 1 = 1
    0 AND 1 = 0
    0 AND 0 = 0
    1 AND 0 = 0

  • 2 inputs

  • 1 output




回答2:


Now you can also use train_on_data, which receives the same arguments as train_on_file, but you change the filename with an object libfann.training_data() and set the lists of lists of input and output as (for the xor case):

training = libfann.training_data()    
training.set_train_data([[-1,-1],[-1,1],[1,-1],[1,1]],[[-1],[1],[1],[-1]])



回答3:


you might find help on this page.

http://leenissen.dk/fann/html/files2/gettingstarted-txt.html#Execution

half-way down the page there is a description of the training data format.



来源:https://stackoverflow.com/questions/12063340/what-is-the-format-of-training-data-in-pyfann

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!