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

What exactly is 'bias' in the context of the program? #8

Open
anansrivastava opened this issue Feb 20, 2019 · 0 comments
Open

What exactly is 'bias' in the context of the program? #8

anansrivastava opened this issue Feb 20, 2019 · 0 comments

Comments

@anansrivastava
Copy link

I have no idea what bias is in the genetic.js. Is it a keyword?

crossOver : function(parentA, parentB) {
		var cutPoint = this.random(0, parentA.neurons.length-1);
		for (var i = cutPoint; i < parentA.neurons.length; i++){
			//what is the bias part. what does it mean
			var biasFromParentA = parentA.neurons[i]['bias'];
			parentA.neurons[i]['bias'] = parentB.neurons[i]['bias'];
			parentB.neurons[i]['bias'] = biasFromParentA;
		}

		return this.random(0, 1) == 1 ? parentA : parentB;
	},

Similarly, is connections a keyword? What is this achieveing?

mutation : function (offspring){
		for (var i = 0; i < offspring.neurons.length; i++){
			offspring.neurons[i]['bias'] = this.mutate(offspring.neurons[i]['bias']);
		}
		
		//is connections a keyword?
		for (var i = 0; i < offspring.connections.length; i++){
			offspring.connections[i]['weight'] = this.mutate(offspring.connections[i]['weight']);
		}
		
		return offspring;
	},

Also, the function 'activate' is not referenced anywhere. I am not sure if that is a keyword because intellisense didn't pick it up. Could somebody tell me how the activate function working?


activateBrain: function(bird, target){
			var horizontalDistance = this.normalize(target.x,700) *this.SCALE_FACTOR;
			var verticalDistance = this.normalize(bird.y - target.y,800) * this.SCALE_FACTOR;	
			var inputs = [horizontalDistance,verticalDistance];
			//not sure what activate is
			var outputs = this.Population[bird.index].activate(inputs);
			if(outputs[0] > 0.5) bird.flap();
	},

Would appreciate if somebody could help me understand these 3 things. Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant