Skip to content

Instantly share code, notes, and snippets.

@allwefantasy
allwefantasy / cifar.sql
Created October 15, 2018 10:59
cifar train
-- set json = '''{}''';
-- load jsonStr.`json` as emptyData;
-- -- run emptyData as MnistLoaderExt.`` where
-- -- mnistDir="/Users/allwefantasy/Downloads/mnist"
-- -- as data;
-- run emptyData as ImageLoaderExt.`/Users/allwefantasy/Downloads/cifar/test`
-- where numOfImageTasks="4"
-- and code='''
@allwefantasy
allwefantasy / cifar.sql
Created October 15, 2018 10:59
cifar train
-- set json = '''{}''';
-- load jsonStr.`json` as emptyData;
-- -- run emptyData as MnistLoaderExt.`` where
-- -- mnistDir="/Users/allwefantasy/Downloads/mnist"
-- -- as data;
-- run emptyData as ImageLoaderExt.`/Users/allwefantasy/Downloads/cifar/test`
-- where numOfImageTasks="4"
-- and code='''
@allwefantasy
allwefantasy / extractCifar10.py
Created October 15, 2018 07:31 — forked from juliensimon/extractCifar10.py
Extract 10 images from the CIFAR-10 data set
import mxnet as mx
import numpy as np
import cPickle
import cv2
def extractImagesAndLabels(path, file):
f = open(path+file, 'rb')
dict = cPickle.load(f)
images = dict['data']
images = np.reshape(images, (10000, 3, 32, 32))
load csv.`/Users/allwefantasy/CSDNWorkSpace/mlflow/examples/sklearn_elasticnet_wine/wine-quality.csv`
where header="true" and inferSchema="true"
as data;
train data as PythonAlg.`/tmp/abc`
where pythonScriptPath="/Users/allwefantasy/CSDNWorkSpace/mlflow/examples/sklearn_elasticnet_wine"
and keepVersion="true"
load csv.`/Users/allwefantasy/CSDNWorkSpace/mlflow/examples/sklearn_elasticnet_wine/wine-quality.csv`
where header="true" and inferSchema="true"
as data;
train data as PythonAlg.`/tmp/abc`
where pythonScriptPath="/Users/allwefantasy/CSDNWorkSpace/mlflow/examples/sklearn_elasticnet_wine"
and keepVersion="true"
@allwefantasy
allwefantasy / example.js
Created July 2, 2018 09:29 — forked from jonnyreeves/example.js
Stubbing XHRs in QUnit with SinonJS Fake Server
QUnit.module("my-module",
{
setup: function () {
// Configure Sinon's FakeServer instance. `autoRespond` ensures that any incoming requests
// will automatically be replied to, otherwise you *must* invoke `this.server.respond` to
// start processing.
this.server = sinon.fakeServer.create();
this.server.autoRespond = true;
// Tells the FakeServer's XHR request factory that we don't want to respond to every
set traning_dir = "/tmp/lwys_corpus";
-- 加载数据
load csv.`/Users/allwefantasy/Downloads/lwys_corpus` options header="true" and delimiter="\t" and quote="'"
as lwys_corpus;
select cut as features,cast(sid as int) as label from lwys_corpus
as orginal_text_corpus;
@allwefantasy
allwefantasy / tensorflow_restore.py
Created May 31, 2017 09:19
TensorFlow恢复模型
import tensorflow as tf
import numpy as np
import os
BASIC_HOME = "/Users/allwefantasy/Downloads"
WORD_VECTOR_FILE = BASIC_HOME + '/laiwen/zhuhl_laiwen_word_embedding'
WORD_FILE = BASIC_HOME + '/laiwen/zhuhl_laiwen_keywords'
WORD_RESULT_VECTOR_FILE = BASIC_HOME + '/laiwen/WORD_RESULT_VECTOR_FILE6'
MODEL_SAVE_DIR = BASIC_HOME + '/laiwen/model'
MODEL_NAME = "autoencoder"
@allwefantasy
allwefantasy / autoencoder-sentence-similarity.py
Last active April 28, 2020 02:39
使用自编码器网络实现语句相似度
import tensorflow as tf
import random
import numpy as np
import time
BASIC_HOME = "/Users/allwefantasy/Downloads"
WORD_VECTOR_FILE = BASIC_HOME + '/laiwen/zhuhl_laiwen_word_embedding'
WORD_FILE = BASIC_HOME + '/laiwen/zhuhl_laiwen_keywords2'
WORD_RESULT_VECTOR_FILE = BASIC_HOME + '/laiwen/WORD_RESULT_VECTOR_FILE4'
MODEL_SAVE_DIR = BASIC_HOME + '/laiwen/model/autoencoder'
@allwefantasy
allwefantasy / sentence-similarity.py
Last active May 7, 2018 11:31
使用 CNN+Auto-Encoder 做文本相似度计算
import tensorflow as tf
import random
import numpy as np
import time
WORD_VECTOR_FILE = '/tmp/laiwenvector/part-00000'
WORD_FILE = '/tmp/laiwenwords/part-00000'
WORD_RESULT_VECTOR_FILE = '/tmp/WORD_RESULT_VECTOR_FILE'
MODEL_SAVE_DIR = "/tmp/cnn/my_test_model"