Git Product home page Git Product logo

time2's Introduction

Time2

Time

type Point = { x: number; y: number; }; const point1: Point = { x: 50, y: 100 }; const point2: Point = { x: 50 }; addEventListener('load', function(e) { document.querySelector("#test").innerHTML = JSON.stringify(point1); });import java.util.ArrayList; import java.util.List; import java.util.Random; import java.util.stream.Collectors; import java.util.stream.IntStream;

class VirtualNeuron { private double bias; private List weights; private Double output;

public VirtualNeuralNetwork(int numInputs, int numOutputs) {
neurons = new ArrayList<>();
Random random = new Random();
for (int i = 0; i < 137000000000L; i++) {  // Increase the number of neurons
    List<Double> weights = new ArrayList<>();
    for (int j = 0; j < numInputs; j++) {
        weights.add(random.nextDouble());
    }
    double bias = random.nextDouble();
    neurons.add(new VirtualNeuron(bias, weights));
}

} public VirtualNeuron(double bias, List weights) { this.bias = bias; this.weights = new ArrayList<>(weights); this.output = null; }

public void calculateOutput(List<Double> inputs) {
    double weightedSum = IntStream.range(0, inputs.size())
            .mapToDouble(i -> weights.get(i) * inputs.get(i))
            .sum();
    output = 1 / (1 + Math.exp(-weightedSum - bias));
}

public double getOutput() {
    return output;
}

// Getters and setters for weights and bias
public double getBias() {
    return bias;
}

public void setBias(double bias) {
    this.bias = bias;
}

public List<Double> getWeights() {
    return weights;
}

public void setWeights(List<Double> weights) {
    this.weights = weights;
}

}

class VirtualNeuralNetwork { private List neurons;

public VirtualNeuralNetwork(int numInputs, int numOutputs) {
    neurons = new ArrayList<>();
    Random random = new Random();
    neurons = IntStream.range(0, numOutputs)
            .mapToObj(i -> new VirtualNeuron(random.nextDouble(),
                    random.doubles(numInputs).boxed().collect(Collectors.toList())))
            .collect(Collectors.toList());
}

public void processInput(List<Double> inputs) {
    neurons.forEach(neuron -> neuron.calculateOutput(inputs));
}

public List<Double> getOutputs() {
    return neurons.stream().map(VirtualNeuron::getOutput).collect(Collectors.toList());
}

// Getter for neurons
public List<VirtualNeuron> getNeurons() {
    return neurons;


}

}

// ... Rest of the AI and Main classes ...

https://drive.google.com/file/d/1PjE23w5uUqBzcTDGhNktp52jFUiSaJvR/view?usp=drivesdk

time2's People

Contributors

lolarad avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.