Tue 27 Aug 00:14:56 CEST 2024
This commit is contained in:
		
							parent
							
								
									7e3e9e1a45
								
							
						
					
					
						commit
						3150d4fda7
					
				
							
								
								
									
										35
									
								
								test/test-ann1.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								test/test-ann1.js
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,35 @@
 | 
			
		|||
var x = [
 | 
			
		||||
    [0,0],
 | 
			
		||||
    [0,1],
 | 
			
		||||
    [1,0],
 | 
			
		||||
    [1,1]
 | 
			
		||||
  ]
 | 
			
		||||
var y = [
 | 
			
		||||
    0,
 | 
			
		||||
    1,
 | 
			
		||||
    1,
 | 
			
		||||
    0
 | 
			
		||||
  ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
var model = ml.train({
 | 
			
		||||
  algorithm:ml.ML.ANN,
 | 
			
		||||
  x:x, 
 | 
			
		||||
  y:y,
 | 
			
		||||
  equal:true,
 | 
			
		||||
  iterations:10000,
 | 
			
		||||
  error:0.1,
 | 
			
		||||
  layers:[2,1]
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
var samples = [
 | 
			
		||||
  [0.1,-0.2],
 | 
			
		||||
  [0.1,1.2],
 | 
			
		||||
  [0.8,0.1],
 | 
			
		||||
  [0.9,1.1]
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
print(ml.predict(model,x))
 | 
			
		||||
print(ml.predict(model,samples))
 | 
			
		||||
//print(ml.test(model,{x:x,y:y}))
 | 
			
		||||
//print(ml.test(model,{x:test,y:y}))
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user