// Abstract ------------------------------------------------------------------------------------------------------------------------------

This sample shows how a feedforward neural network can be used within fizz.

// Examples ------------------------------------------------------------------------------------------------------------------------------

to train: (no validation, 1500 epoch, 0.1 learning rate)

?- /tells(iris.ffbn,acquires)
iris - requesting training data ...
?- /tells(iris.ffbn,practice(1.0,1500,0.1))
iris - training set has 134 samples
iris - practice completed (0.000138,0.000000)
iris - practice completed (0.000471,0.000000)

to test:

?- #iris(4.40,2.90,1.40,0.20,:x)
-> ( setosa ) := 0.98 (0.001) 1
?- #iris(:x,2.90,1.40,0.20,setosa)
-> ( 4.838565 ) := 0.99 (0.001) 1
 
// Code ----------------------------------------------------------------------------------------------------------------------------------

iris {  class = FZZCFFBNetwork,
        alias = iris.ffbn,
        query = iris(_,_,_,_,_),
        generalize = [[i,i,i,i,o],[o,i,i,i,i]],
        formatting = [d,d,d,d,l],
        hidden_layers = 1,
        neurons_in_hidden_layers = 4,
} {

}

iris {

	// (sepal length, sepal width, petal length, petal width, class)

	(5.10,3.50,1.40,0.20,setosa);
	(4.90,3.00,1.40,0.20,setosa);
	(4.70,3.20,1.30,0.20,setosa);
	(4.60,3.10,1.50,0.20,setosa);
	(5.00,3.60,1.40,0.20,setosa);
	(5.40,3.90,1.70,0.40,setosa);
	(4.60,3.40,1.40,0.30,setosa);
	(5.00,3.40,1.50,0.20,setosa);
	(4.90,3.10,1.50,0.10,setosa);
	(5.40,3.70,1.50,0.20,setosa);
	(4.80,3.40,1.60,0.20,setosa);
	(4.80,3.00,1.40,0.10,setosa);
	(5.80,4.00,1.20,0.20,setosa);
	(5.70,4.40,1.50,0.40,setosa);
	(5.40,3.90,1.30,0.40,setosa);
	(5.10,3.50,1.40,0.30,setosa);
	(5.70,3.80,1.70,0.30,setosa);
	(5.10,3.80,1.50,0.30,setosa);
	(5.40,3.40,1.70,0.20,setosa);
	(5.10,3.70,1.50,0.40,setosa);
	(5.10,3.30,1.70,0.50,setosa);
	(4.80,3.40,1.90,0.20,setosa);
	(5.00,3.00,1.60,0.20,setosa);
	(5.00,3.40,1.60,0.40,setosa);
	(5.20,3.50,1.50,0.20,setosa);
	(5.20,3.40,1.40,0.20,setosa);
	(4.70,3.20,1.60,0.20,setosa);
	(4.80,3.10,1.60,0.20,setosa);
	(5.40,3.40,1.50,0.40,setosa);
	(5.20,4.10,1.50,0.10,setosa);
	(5.50,4.20,1.40,0.20,setosa);
	(4.90,3.10,1.50,0.20,setosa);
	(5.00,3.20,1.20,0.20,setosa);
	(5.50,3.50,1.30,0.20,setosa);
	(4.90,3.60,1.40,0.10,setosa);
	(4.40,3.00,1.30,0.20,setosa);
	(5.10,3.40,1.50,0.20,setosa);
	(4.40,3.20,1.30,0.20,setosa);
	(5.00,3.50,1.60,0.60,setosa);
	(5.10,3.80,1.90,0.40,setosa);
	(4.80,3.00,1.40,0.30,setosa);
	(5.10,3.80,1.60,0.20,setosa);
	(4.60,3.20,1.40,0.20,setosa);
	(5.30,3.70,1.50,0.20,setosa);
	(5.00,3.30,1.40,0.20,setosa);
	(7.00,3.20,4.70,1.40,versicolor);
	(6.40,3.20,4.50,1.50,versicolor);
	(6.90,3.10,4.90,1.50,versicolor);
	(5.50,2.30,4.00,1.30,versicolor);
	(6.50,2.80,4.60,1.50,versicolor);
	(5.70,2.80,4.50,1.30,versicolor);
	(6.30,3.30,4.70,1.60,versicolor);
	(4.90,2.40,3.30,1.00,versicolor);
	(6.60,2.90,4.60,1.30,versicolor);
	(5.00,2.00,3.50,1.00,versicolor);
	(5.90,3.00,4.20,1.50,versicolor);
	(6.00,2.20,4.00,1.00,versicolor);
	(6.10,2.90,4.70,1.40,versicolor);
	(6.70,3.10,4.40,1.40,versicolor);
	(5.60,3.00,4.50,1.50,versicolor);
	(5.80,2.70,4.10,1.00,versicolor);
	(6.20,2.20,4.50,1.50,versicolor);
	(5.60,2.50,3.90,1.10,versicolor);
	(5.90,3.20,4.80,1.80,versicolor);
	(6.10,2.80,4.00,1.30,versicolor);
	(6.30,2.50,4.90,1.50,versicolor);
	(6.10,2.80,4.70,1.20,versicolor);
	(6.40,2.90,4.30,1.30,versicolor);
	(6.60,3.00,4.40,1.40,versicolor);
	(6.80,2.80,4.80,1.40,versicolor);
	(6.70,3.00,5.00,1.70,versicolor);
	(6.00,2.90,4.50,1.50,versicolor);
	(5.70,2.60,3.50,1.00,versicolor);
	(5.50,2.40,3.80,1.10,versicolor);
	(5.50,2.40,3.70,1.00,versicolor);
	(5.80,2.70,3.90,1.20,versicolor);
	(5.40,3.00,4.50,1.50,versicolor);
	(6.00,3.40,4.50,1.60,versicolor);
	(6.70,3.10,4.70,1.50,versicolor);
	(6.30,2.30,4.40,1.30,versicolor);
	(5.60,3.00,4.10,1.30,versicolor);
	(5.50,2.50,4.00,1.30,versicolor);
	(5.50,2.60,4.40,1.20,versicolor);
	(6.10,3.00,4.60,1.40,versicolor);
	(5.00,2.30,3.30,1.00,versicolor);
	(5.60,2.70,4.20,1.30,versicolor);
	(5.70,3.00,4.20,1.20,versicolor);
	(5.70,2.90,4.20,1.30,versicolor);
	(6.20,2.90,4.30,1.30,versicolor);
	(5.10,2.50,3.00,1.10,versicolor);
	(6.30,3.30,6.00,2.50,virginica);
	(5.80,2.70,5.10,1.90,virginica);
	(6.30,2.90,5.60,1.80,virginica);
	(6.50,3.00,5.80,2.20,virginica);
	(7.60,3.00,6.60,2.10,virginica);
	(4.90,2.50,4.50,1.70,virginica);
	(7.30,2.90,6.30,1.80,virginica);
	(6.70,2.50,5.80,1.80,virginica);
	(7.20,3.60,6.10,2.50,virginica);
	(6.50,3.20,5.10,2.00,virginica);
	(6.40,2.70,5.30,1.90,virginica);
	(6.80,3.00,5.50,2.10,virginica);
	(5.70,2.50,5.00,2.00,virginica);
	(6.40,3.20,5.30,2.30,virginica);
	(6.50,3.00,5.50,1.80,virginica);
	(7.70,3.80,6.70,2.20,virginica);
	(7.70,2.60,6.90,2.30,virginica);
	(6.00,2.20,5.00,1.50,virginica);
	(6.90,3.20,5.70,2.30,virginica);
	(5.60,2.80,4.90,2.00,virginica);
	(7.70,2.80,6.70,2.00,virginica);
	(6.30,2.70,4.90,1.80,virginica);
	(7.20,3.20,6.00,1.80,virginica);
	(6.20,2.80,4.80,1.80,virginica);
	(6.10,3.00,4.90,1.80,virginica);
	(6.40,2.80,5.60,2.10,virginica);
	(7.20,3.00,5.80,1.60,virginica);
	(7.40,2.80,6.10,1.90,virginica);
	(7.90,3.80,6.40,2.00,virginica);
	(6.40,2.80,5.60,2.20,virginica);
	(6.30,2.80,5.10,1.50,virginica);
	(6.10,2.60,5.60,1.40,virginica);
	(7.70,3.00,6.10,2.30,virginica);
	(6.30,3.40,5.60,2.40,virginica);
	(6.40,3.10,5.50,1.80,virginica);
	(6.00,3.00,4.80,1.80,virginica);
	(6.90,3.10,5.40,2.10,virginica);
	(6.70,3.10,5.60,2.40,virginica);
	(6.90,3.10,5.10,2.30,virginica);
	(5.80,2.70,5.10,1.90,virginica);
	(6.80,3.20,5.90,2.30,virginica);
	(6.70,3.30,5.70,2.50,virginica);
	(6.70,3.00,5.20,2.30,virginica);
	(6.50,3.00,5.20,2.00,virginica);
	(5.90,3.00,5.10,1.80,virginica);

}

iris-test {

	(4.40,2.90,1.40,0.20,setosa);
	(4.30,3.00,1.10,0.10,setosa);
	(4.60,3.60,1.00,0.20,setosa);
	(5.00,3.50,1.30,0.30,setosa);
	(4.50,2.30,1.30,0.30,setosa);
	(5.20,2.70,3.90,1.40,versicolor);
	(5.60,2.90,3.60,1.30,versicolor);
	(6.00,2.70,5.10,1.60,versicolor);
	(5.80,2.60,4.00,1.20,versicolor);
	(5.70,2.80,4.10,1.30,versicolor);
	(7.10,3.00,5.90,2.10,virginica);
	(5.80,2.80,5.10,2.40,virginica);
	(6.70,3.30,5.70,2.10,virginica);
	(6.30,2.50,5.00,1.90,virginica);
	(6.20,3.40,5.40,2.30,virginica);

}

// ---------------------------------------------------------------------------------------------------------------------------------------

[Home] [Email] [Twitter] [LinkedIn]