Skip to content

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

Description

@anansrivastava

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions