Giter VIP home page Giter VIP logo

Comments (5)

titoeb avatar titoeb commented on May 18, 2024 1

I could not find anything in the library so far, and I am currently looking into it :)

from smartcore.

abhikjain360 avatar abhikjain360 commented on May 18, 2024

I'd like to give it a try!

from smartcore.

VolodymyrOrlov avatar VolodymyrOrlov commented on May 18, 2024

Hi @abhikjain360, sounds good!

The basic idea is to define a new function in the BaseVector trait that loads data from CSV file. Once the function read_csv is defined in BaseVector trait it will be automatically available for every type of matrix we support. If the function's definition is too generic, it can always be redefined by a concrete implementation of the matrix later.

One way to implement the function is to read a file first, and use one of the matrix initialization functions to create an instance of BaseMatrix and then push the values into the matrix using set method. I am also open to any additional abstract method you might find useful. E.g. you might want to define a new method on BaseMatrix that can initialize a matrix directly from an iterator.

Things to keep in mind. I plan to redesign BaseMatrix and BaseVector in #85 . One of the problems you will face is a lack of support for integer and string data types. For now feel free to limit method read_csv to floats only.

Let me know if you are stuck or have any questions!

from smartcore.

abhikjain360 avatar abhikjain360 commented on May 18, 2024

okay!

Seeing the read_csv of pandas, I think it would be better to provide something like a builder struct which implements Default, and functions to change the reading options. Should I add a ReadCsv struct in the same file as BaseMatrix<T>, or should I create a seperate file?

Also, in case of errors should I just reuse the Failed? As it uses FailedError which does not cover the cases when reading a file, should I add more options to it or create a new type specific to parsing files? In case of latter I think we can just use the std::io::Error from the standard library.

from smartcore.

kastolars avatar kastolars commented on May 18, 2024

Has this been implemented/resolved?

from smartcore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.