Giter Site home page Giter Site logo

revcozmo / ai Goto Github PK

View Code? Open in Web Editor NEW

This project forked from flovera1/ai

0.0 2.0 0.0 103.31 MB

Repository for artificial intelligence programs. The programs in this repository will vary on the programming language and the subjects. The code is really neat and specific.

C 5.99% C++ 1.77% Python 76.59% Java 0.52% Prolog 0.01% HTML 15.02% Makefile 0.11%

ai's Introduction

Artificial intelligence repository
Content


  • Biobliography Folder
  • First things first, the bibliography contains all the books that I consider are the real basis of what the code is about. And in general, what AI is about.


  • Genetic algorithms-classical example

  • This part of the repository tries to explain what a genetic algorithm is and how "evolution" occurs. A key idea is to find a good representation of the chromosome and how to encode, decode and "score" (fitness function) a chromosome. We are trying to write a genetic algorithm which input is a number and the outout is a formula that generate that number just using: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' and operators such as: '+', '-', '*', '/'. For example: 10 is an input and an output could be: 6 + 4, 8 + 2, 7 + 5 - 2, and so on. The number of generations is limited to 32000.
    The code is written in java, so, so far to execute it, we must use a javac command:
    - javac Chromosome.java
    And then:
    - java Chromosome



  • Descendent Gradient algorithm

  • C++ code :D in this code I implemented the descendent algorithm for two variables. For several variables I'd recommend use the same idea, changing as many arguments as it's needed.
    The code is written in C++, so, to execute it you need to compile with C++ compiler
    - g++ gradient.cpp -o gradient
    And then:
    - ./gradient



  • Clustering

  • Clustering is one of my favorites subjects in artificial intelligence. In this folder you will find an implementation of the K-Means clustering (where K represents the number of the clusters). The data for this case are points(which were generated with "random" numbers), and I did some graphical implementation, so, every cluster was visible (in a plot with a specific color). The code is really straight and simple. To execute it, you need to have Java installed.
    In order to compile the code: - javac KMeans.java
    and to execute: - java KMeans
    The output of the code allows you to do two things: - You will have the numbers classified in the cluster in your bash - You will have a representation of the points (this open to the use that you give to your clusters, but in my opinion every data should be represented in a simple and graphical way, because if not, what's the point, isn't it?).




  • NNFF (Neural Network with Feed Forward)
  • Abstraction of the problem:
    Given a point (x_coordinate, y_coordinate) in the cartesian plane, inside the rectangle (0,0) and (20, 12), classify if the point is inside the circle with center in (10,8) and radius 3.

    This code was actually a project in my bachelor.
    The representation of a the regular neural network with one inner(hidden) layer. The idea here is that you generate the numbers with a prolog program(generarNumeros.pl), so the txt files represent the training sets.

    The code was written in C++.
    The program called:
    -probarMejor.cpp
    it represents the neural network and in it we are trying to build the net and figure out how many neurons and iterations we will need to learn. This is one of my favorite pieces of code. The way to compile the code is as follow:
    - g++ probarMejor.cpp -o probarMejor
    And then to execute the code: - ./probarMejor
    The output of the program is by standard output and again, one part of the information is related to the number of iterations, neurons and the percentage of well classified.
    Another program that we can be delighted of is the "anticonceptivo.cpp"
    How to compile?:
    - g++ anticonceptivo.cpp -o anticonceptivo
    executing as follow:
    - ./anticonceptivo
    or
    - ./anticonceptivo 16 0.669 1000.txt file.out


  • A Star algorithm

  • Some heuristics and useful programs that can be used in any search problem


    This is java code, so, the way to compile is using javac command, for example:
    -javac AStarHeuristic.java
    And the way to execute in this case would be:
    -java AStarHeuristic


  • Graph implementation with classical search algorithms such as DFS, BFS, Branch and Bound

  • Basically what I was looking for here was to be sure that I covered some of the real basics of artificial intelligence and graph theories.
    The way to run this code is running the program called: GraphImplementation.java
    To compile:
    - javac GraphImplementation.java To execute:
    - java GraphImplementation
    And that's it.


  • Instance based learning. Other way of thinking about learning

  • Here comes a change of paradigms/change of thinking. So instead of trying to find a function that can maps some data properly(like neural networks or just a neuron like perceptron), we are going to store a bunch of data and form a "data base", so, everytime that we are trying to find a new value, we just try to find to which "register" in our database is more likely to represent that new value. In this new way of thinking we are going to follow the kNN algorithm.
    How do you execute it ?
    This part of the rep was written in Python.
    running with Python:
    python kNN.py
    The output will depend on the whatever main function you are managing and how you represent your data. In this case, the data is found in iris.data
  • nQueens

  • nQueens is a problem which consist in positioning n queens in a board, in a way that non of them kill each other. Basically what you have to do is to be aware of the constraints and conditions of the problem, and of course know how a queen moves. In this implementation, those constraints are checked from left to right and from top to bottom.
    The code was written in C++ again and you know how to run it:
    compiling:
    - g++ nqueens_backtracking.cpp
    running:
    - ./nqueens_backtracking
    REALLY important: the concept of backtracking is a steping stone in artificial intelligence. Here is an example of a simple implementation of it (nQueens.cpp).
  • proy1 <- is more about neural networks.

  • I am still working in this part of the repository. Coming soon
  • proyGeneticos <- is more about gentic algorithms

  • I am still working in this part of the repository. Coming soon
  • Robocode (one of my favourites)

  • I am still working in this part of the repository. Coming soon

    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.