Skip to content

Can't manage to have a string get analysed by brain.js #188

Closed
@mohammedmulazada

Description

@mohammedmulazada

A GIF or MEME to give some spice of the internet

What is wrong?

The training network doesn't train, it returns NaN for the data that it should have analysed.

Where does it happen?

In the app.js run through node, after receiving data from the Twitter API

How do we replicate the issue?

  1. Use the dummy data below
const trainingData =[  
   {  
      input:'RT @ObamaFoundation: This week—50 years since Dr. Martin Luther King, Jr. was killed—@BarackObama and @RepJohnLewis sat down with a group o…',
      output:{  
         Barack:1
      }
   },
   {  
      input:'Incredible to have a Chicago team in the Final Four. I’ll take that over an intact bracket any day! Congratulations to everybody @LoyolaChicago - let’s keep it going!',
      output:{  
         Barack:1
      }
   },
   {  
      input:'In Singapore with young people who are advocating for education, empowering young women, and getting involved all over Southeast Asia with a profoundly optimistic commitment to building the world they want to see. ',
      output:{  
         Barack:1
      }
   },
   {  
      input:'Very thankful for President Xi of China’s kind words on tarrifs and automobile barriers...also, his enlightenment on intellectual property and technology transfers. We will make great progress together!',
      output:{  
         Donald:1
      }
   },
   {  
      input:'Last night, it was my great honor to host America’s senior defense and military leaders for dinner at the White House. America’s military is the GREATEST fighting force in the history of the world. They all have my pledge of unwavering commitment to our men and women in uniform! ',
      output:{  
         Donald:1
      }
   },
   {  
      input:'A TOTAL WITCH HUNT!!!',
      output:{  
         Donald:1
      }
   }
]
  1. Convert the input using encode
function encode(arg) {
return arg.split('').map(x => (x.charCodeAt(0) / 400));
}
  1. Run it through net.trainAsync()

How important is this (1-5)?

A 4, since I think this should be able to work, but it could be my bad too!

Expected behavior (i.e. solution)

The data should have been analysed, but somewhere inbetween something went wrong!

Other Comments

I'm think the encoding method might not be correct here.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions