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
// Playground - noun: a place where people can play | |
public func id<A>(x : A) -> A { | |
return x | |
} | |
public func error<A>(_ x : String) -> A { | |
assert(false, x) | |
} | |
/// The Continuation Monad |
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
var data = {"id":1,"orderName":"Order from spain","teamName":"Portland penguins","orderType":"lock","discount":5,"contactName":"John doe","contactPhonePrefix":"+32","contactPhoneNumber":"3423232","contactEmail":"[email protected]","contactAddress":"830 Southwest","dealerId":"123","dealerNote":"Lorem ipsum","createdAt":"2017-11-13T16:40:12.000Z","updatedAt":"2017-11-13T16:40:12.000Z","products":[{"id":5,"externalId":"C77124","createdAt":"2017-11-13T16:40:12.000Z","updatedAt":"2017-11-13T16:40:12.000Z","OrderProduct":{"createdAt":"2017-11-13T16:40:12.000Z","updatedAt":"2017-11-13T16:40:12.000Z","orderId":1,"productId":5},"selectedSizes":[{"id":1,"technicalSize":520,"quantity":5,"createdAt":"2017-11-13T16:40:12.000Z","updatedAt":"2017-11-13T16:40:12.000Z","ProductSelectedSize":{"createdAt":"2017-11-13T16:40:12.000Z","updatedAt":"2017-11-13T16:40:12.000Z","productId":5,"selectedSizeId":1}}]}]} | |
var transformation = {"id":"id","order_name":"orderName","team_name":"teamName","order_type":"orderType","discount": |
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
func resize(to: CGFloat) -> UIImage { | |
let scale = to / self.size.width | |
let newHeight = self.size.height * scale | |
UIGraphicsBeginImageContext(CGSize(width: to, height: newHeight)) | |
self.draw(in: CGRect(x: 0, y: 0, width: to, height: newHeight)) | |
let newImage = UIGraphicsGetImageFromCurrentImageContext() | |
UIGraphicsEndImageContext() | |
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
from keras.engine import Model | |
from keras.layers import GlobalAveragePooling2D, Dense | |
from keras.optimizers import SGD | |
from keras.preprocessing.image import ImageDataGenerator | |
from keras.applications import InceptionV3 | |
from keras.applications.inception_v3 import preprocess_input | |
from coremltools.converters.keras import convert | |
from keras.models import load_model | |
train_data_dir = "./../data/train" |
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
import * as tf from '@tensorflow/tfjs' | |
const app = requiere('express')() | |
import '@tensorflow/tfjs-node' | |
tf.setBackend('tensorflow') | |
app.get('/model',(req,res) => { | |
const prediction = await model.predict(req['x']).data() | |
res.send(prediction) | |
}) |
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
from keras import regularizers | |
model = models.Sequential() | |
model.add(layers.Dense(16, kernel_regularizer=regularizers.l2(0.001), | |
activation='relu', input_shape=(10000,))) | |
model.add(layers.Dense(16, kernel_regularizer=regularizers.l2(0.001), | |
activation='relu')) | |
model.add(layers.Dense(1, activation='sigmoid')) |
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
model = models.Sequential() | |
model.add(layers.Dense(16, activation='relu', input_shape=(10000,))) | |
model.add(layers.Dropout(0.5)) | |
model.add(layers.Dense(16, activation='relu')) | |
model.add(layers.Dropout(0.5)) | |
model.add(layers.Dense(1, activation='sigmoid')) |
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
from keras.models import Sequential | |
from keras import models | |
model = Sequential() | |
... | |
# serialize model | |
model.save('my_model.hd5') | |
# later... |
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
from coremltools.converters.keras import convert | |
from keras.models import Sequential | |
model = Sequential() | |
... | |
# In case the model accept a image as input will be more | |
# easier for iOS code declare in that way. | |
coreml_model = convert(model, image_input_names="input1") | |
coreml_model.save('my_model.mlmodel') |
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
class GetParam<A>{ | |
readonly _tag: 'GetParam' = 'GetParam'; | |
readonly _A!: A; | |
readonly _URI!: RequestLifeCycleFURI; | |
constructor(readonly url: string,readonly more: (param:either.Either<Error,string>)=> A){ } | |
} | |
class Validate<A> { | |
readonly _tag: 'Validate' = 'Validate'; |
OlderNewer