Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This binary perceptron with one entrance and one exit doesnt work correctly: #4529

Open
2 tasks done
DrFrankxio opened this issue Jan 13, 2025 · 1 comment
Open
2 tasks done
Labels
answered 🎉 Yay! The issue has been resolved, or the question has been answered. question

Comments

@DrFrankxio
Copy link

Node.js Version

v20.12.0

NPM Version

10.5.0

Operating System

Windows 11

Subsystem

Other

Description

The code is this:

peso=true
activar=(input)=>{
	if(peso==false){
		return !input
	}
	if(peso==true){
		return input
	}
}
aleatorizar=()=>{
	peso=Math.random()*2<1?false:true
}
entrenar=(input,output,charge)=>{
	for(i=0;i<charge;i++){
		if(activar(input)!==output){
			aleatorizar()
		}
	}
}
while(true){
	entrenar(false,true,10)
	entrenar(true,true,10)
	console.log(
		"false => "+activar(false)+
		" true => "+activar(true)
	)
}

Minimal Reproduction

No response

Output

No response

Before You Submit

  • I have looked for issues that already exist before submitting this
  • My issue follows the guidelines in the README file, and follows the 'How to ask a good question' guide at https://stackoverflow.com/help/how-to-ask
@avivkeller
Copy link
Member

Hi, @DrFrankxio! Your code contains an infinite loop, and therefore will never exit.

while (true) { ... } will run forever, until a break; call is ran inside of it.

@avivkeller avivkeller added question answered 🎉 Yay! The issue has been resolved, or the question has been answered. labels Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered 🎉 Yay! The issue has been resolved, or the question has been answered. question
Projects
None yet
Development

No branches or pull requests

2 participants