Basic CSV manipulation and Linear Algebra library - RocketC

I am working on a library which will provide functionality to program machine learning algorithms from scratch. It’s in very early stage and contains only basic functionalities, I am working on it. Please go through it once and provide valuable feedback and suggestions.

I wish there was an easier way of commenting on committed code in GitHub!

Some things I noticed with a 5 minute once over…

  • Don’t use func (d *DataFrame) when you aren’t modifying d just use func (d DataFrame) - DataFrame is a slice and very cheap to pass around. It will make your code cleaner too! (Same with Matrix)
  • make(DataFrame, row, row) is redundant, just make(DataFrame, row) is fine
  • Rather than doing n := m.Row() then for i := 0; i < n; i++ { I’d just do for i := range m { but YMMV
  • ReadCsvMatrix should be called ReadCSVMatrix
  • ReadCsvMatrix should return (Matrix, error) - don’t print errors and return nil, return them!
  • dropFrist is spelled wrong - dropFirst
  • Advanced: defer f.Close() where you are writing to f can mask errors - you should check the error here

Good luck!

Thanks for providing some feedback, I will make changes suggested by you.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.