about summary refs log tree commit diff
path: root/README.md
blob: 314f759c3110c12dfb57143d3bb2d9549a661e73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# correlation_rust
implementation of correlation with rust


Ensure you have rust toolchain  and cargo installed

run 

``` rust 

cargo build --release     //for optimization 

//or

cargo build  // for general debug


```

### Run Correlation

accepts json file with the following parameters
example 
expected dataset file example see --> ./tests/data/dataset_with_nans.txt

``` json

//example.json

{
    "file_path":"/home/kabui/correlation_rust/tests/data/db300.txt", //bath to dataset file
    "x_vals":"25.08439, 72.02225, 47.56293, 22.87893, 14.28721, 71.84655, 87.81991, 84.86824, 6.72478, 5.72373, 73.47078, 63.74703",
    "sample_values":"bxd1", //do be implemented 
    "method":"pearson",  //method implemented are pearson and spearman
    "file_delimiter":",",  //needed to parse file e.g 12|212|212 delimiter=1
    "output_file":"/home/kabui/correlation_rust/output.txt" //generic path to ouput results
 }


```

``` rust 


cargo run --release example_json


```

### using guix

## Using Guix

```sh

guix shell --container --network nss-certs --development gn-rust-correlation
```

Export environment variables needed by cargo to get dependencies:

```
export SSL_CERT_DIR="${GUIX_ENVIRONMENT}/etc/ssl/certs"
export SSL_CERT_FILE="${SSL_CERT_DIR}/ca-certificates.crt"
export LD_LIBRARY_PATH="${GUIX_ENVIRONMENT}/lib"
```
Now you can run the cargo commands, e.g. to run unit tests:

``` rust 
cargo test
```


- expected results results are is results to written to file contain

   - row name
   - rho value
   - p_val



### Tests


``` rust


 cargo test  // to run the unittests


```


### Benchmark

``` rust

cargo bench

```

### Performance

performance comparison with python scipy stats
 

- this was conducted using same dataset and 16 column matrix




| number of rows      | python | rust |
| ----------- | ----------- | ---------|
| 1000000       |  118s | 6.04 s|  
| 300000      | 38.06s     |   4.37s      |
|100000   | 13.17s         |    1.36s   |               
| 10000   | 1.21s          | 0.557s|




### Todo


- [x] implementation of pearson and spearman correlation

- [x] benchmarks and tests


- [ ] code optimization e.g use of iterators and lazy computation

- [x] implementation of extern sorter


- [ ] improve on error handling and messages

- [ ] parallel computation

- [ ]  Figure out how to tell cargo to use the declared dependencies, rather than dowloading the dependencies