I am trying to extract rules from a file, to subset a data set:
file1: (3 columns with numeric values,correct class column, empty predicted class column)
For file 2: Line# is to indicate addition of rules (e.g. 3 means add line 3 rule)
file2:(Line#, column, numeric, (less or =) numeric, (more than)numeric) column: is the column number in the original dataset numeric: is the value to compare
The line number indicating the e.g. case of 2: Rule: file1 assign cat if column[3]=<2.04
how to extract rules from a file in this format to assign predicted classes to file1:
Line# column numeric =<numeric >numeric
1 3 2.04 cat 2
2 2 1.5 3 4
3 3 4.6 5 dog
4 1 1.2 dog cat
5 1 1.88 bird cat
Expected output e.g.:
e.g. case of until line 5 line tracking (2,3,4, bird or cat)
if (column[3]>2.04)& (column[2]=<1.5)& (column[3]=<4.6) & (column[1]=<1.88) assign bird
if (column[3]>2.04)& (column[2]=<1.5)& (column[3]=<4.6) & (column[1]>1.88) assign cat
Aucun commentaire:
Enregistrer un commentaire