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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:39:00+00:00 2026-05-12T17:39:00+00:00

Given four binary vectors which represent classes: [1,0,0,0,0,0,0,0,0,0] [0,0,0,0,0,0,0,0,0,1] [0,1,1,1,1,1,1,1,1,0] [0,1,0,0,0,0,0,0,0,0] What methods are

  • 0

Given four binary vectors which represent “classes”:

[1,0,0,0,0,0,0,0,0,0]
[0,0,0,0,0,0,0,0,0,1]
[0,1,1,1,1,1,1,1,1,0]
[0,1,0,0,0,0,0,0,0,0]

What methods are available for classifying a vector of floating point values into one of these “classes”?

Basic rounding works in most cases:

round([0.8,0,0,0,0.3,0,0.1,0,0,0]) = [1 0 0 0 0 0 0 0 0 0] 

But how can I handle some interference?

round([0.8,0,0,0,0.6,0,0.1,0,0,0]) != [1 0 0 0 0 1 0 0 0 0]

This second case should be a better match for 1000000000, but instead, I have lost the solution entirely as there is no clear match.

I want to use MATLAB for this task.

  • 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-12T17:39:00+00:00Added an answer on May 12, 2026 at 5:39 pm

    Find the SSD (sum of squared differences) of your test vector with each “class” and use the one with the least SSD.

    Here’s some code: I added a 0 to the end of the test vector you provided since it was only 9 digits whereas the classes had 10.

    CLASSES = [1,0,0,0,0,0,0,0,0,0
               0,0,0,0,0,0,0,0,0,1
               0,1,1,1,1,1,1,1,1,0
               0,1,0,0,0,0,0,0,0,0];
    
    TEST = [0.8,0,0,0,0.6,0,0.1,0,0,0];
    
    % Find the difference between the TEST vector and each row in CLASSES
    difference = bsxfun(@minus,CLASSES,TEST);
    % Class differences
    class_diff = sum(difference.^2,2);
    % Store the row index of the vector with the minimum difference from TEST
    [val CLASS_ID] = min(class_diff);
    % Display
    disp(CLASSES(CLASS_ID,:))
    

    For illustrative purposes, difference looks like this:

     0.2    0   0   0   -0.6    0   -0.1    0   0   0
    -0.8    0   0   0   -0.6    0   -0.1    0   0   1
    -0.8    1   1   1    0.4    1    0.9    1   1   0
    -0.8    1   0   0   -0.6    0   -0.1    0   0   0
    

    And the distance of each class from TEST looks like this, class_diff:

     0.41
     2.01
     7.61
     2.01
    

    And obviously, the first one is the best match since it has the least difference.

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

Sidebar

Related Questions

Given four (x,y) pairs that represent the four corners of an arbitrary polygon (quadrilateral)
Is possible to draw a quad given its normal vector, a point that is
I have a four-byte string read from a binary file, which is supposed to
I have a four-byte string read from a binary file, which is supposed to
Given an array like {one two, three four five}, how'd you calculate the total
Given four tables: CREATE TABLE LIST_A ( A INT, PRIMARY KEY (A) ) CREATE
Given 2 strings, I want to find the first match of at least four
I am using a tab layout in which i have four part.first part showing
Given the decimal 71744474 in binary it is 0100010001101011101111011010 what I am trying to
I have a CouchDB view from which I emit three or four fields. If

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.