-
Notifications
You must be signed in to change notification settings - Fork 11
/
Transform.java
45 lines (38 loc) · 1.14 KB
/
Transform.java
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
package transform;
import java.util.List;
import java.util.ArrayList;
import java.lang.Math;
/**Methods to Transform Time Series (log and power transformations)
*
* @author navdeepgill
*/
public class Transform {
public static List<Double> log(List<Double> data) {
List<Double> t_list = new ArrayList<Double>(data.size());
for (double i : data) {
t_list.add(Math.log(i));
}
return t_list;
}
public static List<Double> sqrt(List<Double> data){
List<Double> t_list = new ArrayList<Double>(data.size());
for (double i : data) {
t_list.add(Math.sqrt(i));
}
return t_list;
}
public static List<Double> cbrt(List<Double> data){
List<Double> t_list = new ArrayList<Double>(data.size());
for (double i : data) {
t_list.add(Math.cbrt(i));
}
return t_list;
}
public static List<Double> root(List<Double> data, double root){
List<Double> t_list = new ArrayList<Double>(data.size());
for (double i : data) {
t_list.add(Math.pow(i,1.0/root));
}
return t_list;
}
}