Borrowed from SRNN code. Reads a csv and returns a float matrix. https://github.com/asheshjain399/NeuralModels/blob/master/neuralmodels/utils.py#L34 Args filename: string. Path to the csv file Returns returnArray: the read data in a float32 matrix
(filename)
| 195 | |
| 196 | |
| 197 | def readCSVasFloat(filename): |
| 198 | """ |
| 199 | Borrowed from SRNN code. Reads a csv and returns a float matrix. |
| 200 | https://github.com/asheshjain399/NeuralModels/blob/master/neuralmodels/utils.py#L34 |
| 201 | |
| 202 | Args |
| 203 | filename: string. Path to the csv file |
| 204 | Returns |
| 205 | returnArray: the read data in a float32 matrix |
| 206 | """ |
| 207 | returnArray = [] |
| 208 | lines = open(filename).readlines() |
| 209 | for line in lines: |
| 210 | line = line.strip().split(',') |
| 211 | if len(line) > 0: |
| 212 | returnArray.append(np.array([np.float32(x) for x in line])) |
| 213 | |
| 214 | returnArray = np.array(returnArray) |
| 215 | return returnArray |
| 216 | |
| 217 | |
| 218 | def normalize_data(data, data_mean, data_std, dim_to_use, actions, one_hot): |
no outgoing calls
no test coverage detected