Skip to content

Instantly share code, notes, and snippets.

@shubham0204
Last active April 21, 2021 13:57
Show Gist options
  • Save shubham0204/906c6865fa73f6f872f56422e561ec2e to your computer and use it in GitHub Desktop.
Save shubham0204/906c6865fa73f6f872f56422e561ec2e to your computer and use it in GitHub Desktop.
...
// Number of features in the dataset. This number equals ( num_cols - 1 ) where num_cols is the number of
// columns in the CSV file.
// ( Note: We assume that the file has the labels column as the last column ).
var numFeatures = 0
// Number of samples in the dataset. This number equals ( num_rows - 1 ) where num_rows is the number of
// rows in the CSV file.
// Note: We assume that the CSV file has its first row as the column names.
var numSamples = 0
...
// Initialize the `featureColumnData`
private fun initTable() {
// `numFeatures` = num_cols - 1
numFeatures = rawData[ 0 ].size - 1
// `numSamples` = num_rows - 1
numSamples = rawData.size - 1
// For each entry in `featureColumnData` initialize an empty ArrayList with key=column_name.
for ( i in 0 until numFeatures ) {
featureColumnData[ columnNames[ i ] ] = ArrayList()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment