|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--shared.FileSchema
This class represents an MLC++ names file. The FileSchema's main task is to interpret the values in a .data file. Currently, a FileSchema maintains a raw list of attribute infos or COLUMNS, information about which columns should represent label or weight values in the final schema, and an optional loss matrix.
FileSchemas may be created from a names file, or from a preexisting array of attribute infos which may be built programmatically. The label column, weight column, and loss matrix may all be set programatically.
At any time, a standard MLC++ Schema may be created from the FileSchema through the create_schema() function.
Displaying a FileSchema will do so in the same format used to read FileSchemas from names files.
| Field Summary | |
static byte |
adefault
LossKeyword value. |
static byte |
distance
LossKeyword value. |
static int |
MAX_INPUT_STRING_SIZE
Maximum size for a String value. |
static byte |
nodefault
LossKeyword value. |
static byte |
nomatrix
LossKeyword value. |
static byte |
sectionCharacter
Byte value indicating a character is an alpha-numerical character. |
static byte |
sectionDelimiter
Byte value indicating a character is a section delimeter. |
static byte |
sectionEscape
Byte value indicating an end-of-file character has been reached. |
| Constructor Summary | |
FileSchema(FileSchema other)
Copy constructor. |
|
FileSchema(java.lang.String namesFile)
Constructor. |
|
| Method Summary | |
void |
apply_loss_spec(Schema s)
Apply the loss specification stored in this FileSchema to the given schema. |
Schema |
create_schema()
Create an MLJ style schema from all the information stored in this class. |
void |
display()
Display this FileSchema. |
int |
find_attribute(java.lang.String[] name,
boolean fatalOnNotFound)
Find an attribute in the file schema by name. |
boolean |
get_ignore_weight_column()
Returns TRUE if the weight column is to be ignored, FALSE otherwise. |
int |
get_label_column()
Returns the column number of the column containing labels. |
int |
get_weight_column()
Returns the column number of the column containing weight values. |
int |
num_attr()
Returns the number of attributes in this FileSchema. |
java.lang.String |
read_word_on_same_line(java.io.BufferedReader stream,
boolean qMark,
boolean periodAllowed)
Reads a single word from the supplied BufferedReader without crossing lines. |
java.lang.String |
read_word(java.io.BufferedReader stream,
boolean qMark,
boolean[] sameLine)
Reads a single word from the supplied BufferedReader. |
void |
set_attr_info(int i,
AttrInfo a)
Set an attribute info. |
boolean |
skip_white_comments_same_line(java.io.BufferedReader stream)
Skips white space and comments. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public static final byte nomatrix
public static final byte nodefault
public static final byte adefault
public static final byte distance
public static final byte sectionDelimiter
public static final byte sectionEscape
public static final byte sectionCharacter
public static final int MAX_INPUT_STRING_SIZE
| Constructor Detail |
public FileSchema(java.lang.String namesFile)
namesFile - Name of the namesfile containing the schema to be used.public FileSchema(FileSchema other)
other - The FileSchema to be copied.| Method Detail |
public boolean get_ignore_weight_column()
public int get_weight_column()
public int get_label_column()
public void apply_loss_spec(Schema s)
s - The schema to which the loss specification is to be applied.public int num_attr()
public void set_attr_info(int i,
AttrInfo a)
i - Number of the attribute.a - Attribute information.public boolean skip_white_comments_same_line(java.io.BufferedReader stream)
stream - Reader allowing access to the namesfile.
public java.lang.String read_word(java.io.BufferedReader stream,
boolean qMark,
boolean[] sameLine)
stream - The BufferedReader to be read from.qMark - TRUE if question marks are an acceptable name, FALSE otherwise.sameLine - Set to TRUE if the line has not changed in the process of reading this word, FALSE
otherwise.
public java.lang.String read_word_on_same_line(java.io.BufferedReader stream,
boolean qMark,
boolean periodAllowed)
stream - The BufferedReader to be read from.qMark - TRUE if question marks are an acceptable name, FALSE otherwise.periodAllowed - TRUE if periods are allowed as words, FALSE otherwise. Automatically set to
FALSE in this function.
public int find_attribute(java.lang.String[] name,
boolean fatalOnNotFound)
name - Name of the attribute.fatalOnNotFound - TRUE if an error message should be displayed if there is no attribute matching
that name, FALSE otherwise.public Schema create_schema()
public void display()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||