Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7562305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:22:59+00:00 2026-05-30T13:22:59+00:00

Machine learning algorithms in OpenCV appear to use data read in CSV format. See

  • 0

Machine learning algorithms in OpenCV appear to use data read in CSV format. See for example this cpp file. The data is read into an OpenCV machine learning class CvMLData using the following code:

CvMLData data;
data.read_csv( filename ) 

However, there does not appear to be any readily available documentation on the required format for the csv file. Does anyone know how the csv file should be arranged?

Other (non-Opencv) programs tend to have a line per training example, and begin with an integer or string indicating the class label.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T13:23:01+00:00Added an answer on May 30, 2026 at 1:23 pm

    If I read the source for that class, particularly the str_to_flt_elem function, and the class documentation I conclude that valid formats for individual items in the file are:

    1. Anything that can be parsed to a double by strod
    2. A question mark (?) or the empty string to represent missing values
    3. Any string that doesn’t parse to a double.

    Items 1 and 2 are only valid for features. anything matched by item 3 is assumed to be a class label, and as far as I can deduce the order of the items doesn’t matter. The read_csv function automatically assigns each column in the csv file the correct type, and (if you want) you can override the labels with set_response_index. Delimiter wise you can use the default (,) or set it to whatever you like before calling read_csv with set_delimiter (as long as you don’t use the decimal point).

    So this should work for example, for 6 datapoints in 3 classes with 3 features per point:

    A,1.2,3.2e-2,+4.1
    A,3.2,?,3.1
    B,4.2,,+0.2
    B,4.3,2.0e3,.1
    C,2.3,-2.1e+3,-.1
    C,9.3,-9e2,10.4
    

    You can move your text label to any column you want, or even have multiple text labels.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am tasked with detecting anomalies (known or unknown) using machine-learning algorithms from data
I am a student trying to use some of the machine learning algorithms for
I have recently become interested in the field(s) of data mining and machine learning.
My machine is little-endian (Intel byte order). I need to read a binary file
Background: I'm doing machine learning research, and want to use the FANN library to
I'm studying simple machine learning algorithms, beginning with a simple gradient descent, but I've
The FIND-S algorithm is probably one of the most simple machine learning algorithms. However,
How well do Python machine learning algorithms scale for web applications? So far, I
It seems that there are certain machine learning algorithms out there that are most
so I'm building this collaborative filtering system using Weka's machine learning library JAVA API...

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.