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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:15:08+00:00 2026-05-16T06:15:08+00:00

i = 0; while (fscanf(fp, %f %f %d, &x[i], &y[i], &outputs[i]) != EOF) {

  • 0
i = 0;
while (fscanf(fp, "%f %f %d", &x[i], &y[i], &outputs[i]) != EOF) {
    if (outputs[i] == 0) {
        outputs[i] = -1;
    }
    i++;
}
patternCount = i;

I dont understand the meaning of this line from the above code:

if (outputs[i] == 0) {
        outputs[i] = -1;

What does it represent. The Output is a matrix or vector.??

The refrence of the code is:
Perceptron learning algorithm not converging to 0

I have a output file that has 3 columns:

1 0 0
0 0 1
0 1 0

So it a vector file??

  • 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-16T06:15:08+00:00Added an answer on May 16, 2026 at 6:15 am

    outputs is defined as a one-dimensional array containing integer values..

    float x[208], y[208];
    int outputs[208];
    

    Each index in the array can be seen as corresponding to a line read in the data file.

      i       x              y      outputs
      --------------------------------------
      0 | -8.818681   3.025210     1
      1 |  3.653846  -2.969188     0
      2 |  ...           ...           .
     .. |  ...           ...           .
    208 | -6.565934  -4.649860     1
    

    Where if i == 0 then

    x[0]       == -8.818681
    y[0]       == 3.025210
    outputs[0] == 1
    

    The wonderful code and information posted by user Amro explain the limits and function of outputs.

    “…bias term, i.e. a third weight component connected to an input of value 1. (+1/-1)
    “

    Values for outputs in the data file have been assigned one/zero values.
    Therefore the code in question checks to see if the value for outputs read in from the file is equal to zero and re-assigns to a -1.

    if (outputs[i] == 0)
        outputs[i] = -1;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.