GithubHelp home page GithubHelp logo

simulated_annealing's Introduction

simulated_annealing

This will in the end implement the final project ffrom this R course:

https://sccbioinformatics.github.io/R_programming_1/#The_Final_Project

The main steps are these:

  1. load the data into Rust
  2. scale the data to lie between 0 and 1
  3. randomly group the genes into k clusters
  4. Calculate the eucledian distances between the genes and sum all these values per cluster
  5. calculate the mean 'energy' in the system as mean cluster energy

Now the fun starts - randomly asign one gene to a different cluster and re-run 5 and 6. Compare the two energies and keep the clusters if the new energy is lower than the old or if the new energy is higher than the old only keep this change if this term is true:

$$ e^-{(E_{new} - E_{old}) \over T} > random(0,1) $$

With T being the temperature of the system.

  1. Then scale the temperatue by the cooling factor.

Install

You need the Rust compiler: https://www.rust-lang.org/tools/install

Then you can clone this repo and complie the code:

git clone [email protected]:stela2502/simulated_annealing.git
cd simulated_annealing
cargo build -r

Testing

target/release/simulated_annealing -c 12 --it 100000 --t1 20 --cf 0.9995
Rscript testData/Visualize.R

Usage

simulated_annealing  -h
simulated_annealing 1.0.0
Stefan L. <[email protected]>
Run a simulated anealing clustering over the rows of the provided data. The software is a demo
project for the Lund Stem Cell Center - Bioinformatics Rust workshop.

USAGE:
    simulated_annealing [OPTIONS]

OPTIONS:
    -c, --clusters <CLUSTERS>    the target cluster count [default: 10]
        --cf <CF>                the cooling factor [default: 0.9995]
    -d, --data <DATA>            the data (text file) [default:
                                 testData/Spellman_Yeast_Cell_Cycle.tsv]
    -h, --help                   Print help information
        --it <IT>                the number of iterations [default: 25000]
    -o, --outpath <OUTPATH>      the outpath [default: testData/TestClustering]
    -s, --sep <SEP>              the column separator for the file [default: \t]
        --start <START>          a starting grouping [default: testData/RFclustered.txt]
        --t1 <T1>                the starting temperature [default: 20]
    -V, --version                Print version information

Output

target/release/simulated_annealing  --start "notThis" -c 10
I got 256 rows and 16 cols in this data
precalculate the distances between genes
Finished
randomly assigning groups
Starting energy is 486.76
finished in 0 h 0 min 0 sec 31 milli sec - end energy was 294.19 with 7475 gene shifts (0.30%) and end t1 = 0.00

simulated_annealing's People

Contributors

stela2502 avatar

Watchers

 avatar  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.