Tue 27 Aug 00:14:56 CEST 2024
This commit is contained in:
		
							parent
							
								
									de5c2d7fdb
								
							
						
					
					
						commit
						fff72505c9
					
				
							
								
								
									
										21
									
								
								test/test-ice.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								test/test-ice.js
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,21 @@
 | 
				
			||||||
 | 
					var x = csv.read('test-c45-3-X.csv'),
 | 
				
			||||||
 | 
					    y = csv.read('test-c45-3-Y.csv');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					x.shift(); // remove header
 | 
				
			||||||
 | 
					y.shift();
 | 
				
			||||||
 | 
					// print(y)
 | 
				
			||||||
 | 
					var model = ml.learn({
 | 
				
			||||||
 | 
					  algorithm:ml.ML.ICE,
 | 
				
			||||||
 | 
					  x:x, 
 | 
				
			||||||
 | 
					  y:y,
 | 
				
			||||||
 | 
					  eps:0.01
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					var targets,samples = csv.read('test-c45-3-S.csv');
 | 
				
			||||||
 | 
					samples.shift();
 | 
				
			||||||
 | 
					targets=ml.stats.utils.column(samples,x[0].length);
 | 
				
			||||||
 | 
					samples=ml.stats.utils.select(samples,[0,x[0].length-1]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					print(toJSON(model).length+' Bytes')
 | 
				
			||||||
 | 
					// print(ml.print(model))
 | 
				
			||||||
 | 
					print(ml.classify(model,samples))
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user