Tue 27 Aug 00:14:56 CEST 2024
This commit is contained in:
		
							parent
							
								
									3150d4fda7
								
							
						
					
					
						commit
						a1265a35d1
					
				
							
								
								
									
										19
									
								
								test/test-c45-3.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								test/test-c45-3.js
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,19 @@
 | 
				
			||||||
 | 
					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.C45,
 | 
				
			||||||
 | 
					  x:x, 
 | 
				
			||||||
 | 
					  y:y,
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					var samples = csv.read('test-c45-3-S.csv');
 | 
				
			||||||
 | 
					samples.shift();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					print(toJSON(model).length+' Bytes')
 | 
				
			||||||
 | 
					// print(ml.print(model))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					print(ml.classify(model,samples))
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user