This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DATA_URL = 'http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz' | |
def create_graph(): | |
"""Creates a graph from saved GraphDef file and returns a saver.""" | |
# Creates graph from saved graph_def.pb. | |
with tf.gfile.FastGFile('classify_image_graph_def.pb', 'rb') as f: | |
graph_def = tf.GraphDef() | |
graph_def.ParseFromString(f.read()) | |
_ = tf.import_graph_def(graph_def, name='') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(*A good example*) | |
let y = Mat.(gaussian 100 1 *$ 10.) in | |
let h = create "" in | |
let _ = set_background_color h 28 28 28 in | |
let _ = set_title h "Gaussian Data to fit Weibull Dist" in | |
let _ = set_xlabel h "Sample Data" in | |
let _ = set_ylabel h "Theoratical Weibull Distribution invCdf" in | |
let _ = probplot ~h ~dist:(fun i -> Owl_stats.Cdf.weibull_Pinv i 1. 1.) y in | |
output h;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(*example*) | |
(*Add logscale: Add xlogscale and ylogscale properties to a page; | |
The logdata still needs to be precomputed.*) | |
let x = Mat.logspace (-1.) 2. 10 in | |
let y = Mat.map Maths.exp x in | |
let z = Mat.log10 y in | |
let h = create "log4.pdf" in | |
let _ = scatter ~h ~color:(255,0,0)~marker:"#[0x2299]" ~marker_size:8. x z in |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
231 210 156 159 159 159 160 154 166 163 166 167 160 168 171 175 170 166 175 167 169 175 165 168 169 166 177 174 167 169 172 177 175 171 173 172 161 167 175 172 167 177 172 169 169 171 170 180 172 172 171 167 177 178 173 183 166 173 171 175 175 169 173 173 170 166 170 172 164 172 171 171 174 168 170 177 162 169 174 160 165 172 172 174 173 174 174 172 170 171 175 168 182 170 172 166 179 176 172 171 170 175 177 169 170 175 172 173 171 176 173 177 177 187 170 179 177 181 181 177 181 176 183 179 182 188 182 183 184 186 188 182 186 182 183 184 182 191 184 189 187 189 185 185 184 190 192 193 190 187 192 185 185 186 191 188 199 191 197 193 197 202 185 198 196 189 197 198 184 201 201 199 192 205 196 204 201 206 208 208 203 199 217 205 205 204 213 204 210 201 221 205 213 208 218 212 215 211 215 213 218 211 216 218 210 226 217 212 218 220 214 222 222 227 219 222 218 216 221 224 218 214 222 224 214 219 220 222 219 216 228 219 225 225 226 223 225 222 219 227 220 234 207 221 217 227 217 228 220 227 219 232 218 230 221 225 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Owl | |
open Owl_neural | |
open Algodiff.S | |
open Owl_neural_neuron | |
(* | |
let test_cnn nn x y = | |
for i = 0 to 9 do | |
let u = Dense.Ndarray.S.slice [[i]] x in | |
Dense.Ndarray.S.reshape u [|3;32;32|] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Owl_neural | |
open Owl_neural_graph | |
open Algodiff.S | |
open Owl_neural_neuron | |
open Plplot | |
let x, y = Dataset.load_cifar_train_data 1 | |
let m = Dense.Matrix.S.row_num x | |
let num_test = 9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* source: http://ai.stanford.edu/~amaas/data/sentiment/ *) | |
let vocab_file = "imdb.vocab" | |
let load_file f = | |
let ic = open_in f in | |
let n = in_channel_length ic in | |
let s = Bytes.create n in | |
really_input ic s 0 n; | |
close_in ic; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
Example script to generate text from Nietzsche's writings. | |
At least 20 epochs are required before the generated text | |
starts sounding coherent. | |
It is recommended to run this script on GPU, as recurrent | |
networks are quite computationally intensive. | |
Adapted from Keras example: lstm_text_generation.py | |
*) |
OlderNewer