An implementation of the ID3 Decision Tree algorithm in Java from scratch.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

65 lines
951 B

package com.AI;
import java.util.*;
class Cell
{
private String attributeName;
private String value;
public String getAttributeName() {
return attributeName;
}
public void setAttributeName(String attributeName) {
this.attributeName = attributeName;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
public class Row
{
private ArrayList<Cell> cellsList;
public ArrayList<Cell> getCellsList() {
return cellsList;
}
public void setCellsList(ArrayList<Cell> cellsList) {
this.cellsList = cellsList;
}
public Row()
{
cellsList = new ArrayList<>();
}
public void setRow(String attributeName, String value)
{
Cell cell = new Cell();
cell.setAttributeName(attributeName);
cell.setValue(value);
cellsList.add(cell);
}
}
class Logarithms
{
public static double log2(double exponent)
{
return Math.log10(exponent) / 0.3010299956639812;
}
}