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 8541939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:56:39+00:00 2026-06-11T11:56:39+00:00

I am new to sklearn and in general to python as well. Can you

  • 0

I am new to sklearn and in general to python as well. Can you help me figure out if this script is leading to some solution? Basically I am using an hue extractor on an Imageset: load iset for training, extract features, define classifier and then classify.

    #load beach for training
iset = ImageSet('/Users/Arenzky/Desktop/img_dirs/supervised/beach/') #load Image database

hue = HueHistogramFeatureExtractor() # define extractor
edge = EdgeHistogramFeatureExtractor()
x = []
y = []
for b in iset:
    ...:        x.append(hue.extract(b))

hset = ImageSet('/dir/.../h01/') 
hue = HueHistogramFeatureExtractor() # define extractor
edge = EdgeHistogramFeatureExtractor()
for h01 in hset:
    ...:        y.append(hue.extract(h01))

dataset = np.array(x)
targets = np.array(y)

print 'Training Machine Learning'
clf = LinearSVC()
clf = clf.fit(x, y)
clf2 = LogisticRegression().fit(x, y)

#predict 

…
after loading clf I get:

ValueError: 
X and Y have incompatible shapes. X has 20 samples, but Y has 286.
  • 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-06-11T11:56:40+00:00Added an answer on June 11, 2026 at 11:56 am

    The error message is pretty explicit: you have 20 samples (rows) in your input datasets and 286 labels hence the mismatch. Each sample should be labeled once hence y.shape[0] should be equal to x.shape[0]. I don’t know how your feature extractors work (and you did not put the import lines but by googling it’s from SimpleCV). Please refer to the documentation of this module to understand the nature of their output and how to transform them to something that satisfy the sklearn shapes assumptions.

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

Sidebar

Related Questions

New to Python and trying to figure out what went wrong here. Making a
New to Java, and can't figure out what I hope to be a simple
New to objective-c and I just can't find the answer to this question anywhere.
New to node.js and just cant figure out how to do the following: I
New Rails programmer here. There is probably a pretty simple solution to this, but
New to python, competent in a few languages, but can't see a 'snazzy' way
new to python. This is probably simple but I haven't found an answer. rndStr
new to JavaScript seeking some help. I have a form with a select drop
New to matlab and I need some help. I need to create a .mat
new to Bootstrap, following this question almost exactly, and can't seem to make my

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.