コード例 #1
0
ファイル: nn_theano_v3.py プロジェクト: asterix135/CKME136
    plt.title(title)
    plt.colorbar()
    tick_marks = np.arange(len(CM_LABELS))
    plt.xticks(tick_marks, CM_LABELS, rotation=45)
    plt.yticks(tick_marks, CM_LABELS)
    plt.tight_layout()
    plt.ylabel('True label')
    plt.xlabel('Predicted label')

NUM_PER_CATEGORY = 5500

print('loading data....')
print(str(NUM_PER_CATEGORY) + ' examples per category')
start_time = time.time()
# images, labels = prep.get_crowdflower(NUM_PER_CATEGORY)
images, labels = prep.get_data(NUM_PER_CATEGORY)
images = images.astype('float32')
train_x, test_x, train_y, test_y = train_test_split(
    images, labels, train_size=.7, random_state=20160319)
print('Total data load time:')
print('---------------------')
print(time.time() - start_time)

os.system('say "data is loaded"')


# Consider trying different values for output_layers
print('\nstarting nn on twitter with logit @ -2....')
tf = OverfeatTransformer(output_layers=[-2])
clf = LogisticRegression()
# clf = SVC()
コード例 #2
0
    plt.title(title)
    plt.colorbar()
    tick_marks = np.arange(len(CM_LABELS))
    plt.xticks(tick_marks, CM_LABELS, rotation=45)
    plt.yticks(tick_marks, CM_LABELS)
    plt.tight_layout()
    plt.ylabel("True label")
    plt.xlabel("Predicted label")


NUM_PER_CATEGORY = 1000

print("loading data....")
print(str(NUM_PER_CATEGORY) + " examples per category")
start_time = time.time()
train_x, train_y = prep.get_data(NUM_PER_CATEGORY)
train_x = train_x.astype("float32")
test_x, test_y = prep.get_crowdflower(NUM_PER_CATEGORY)
test_x = test_x.astype("float32")
print("Total data load time:")
print("---------------------")
print(time.time() - start_time)

os.system('say "data is loaded"')


# Consider trying different values for output_layers
print("\nstarting nn trained on twitter with logit @ -2....")
tf = OverfeatTransformer(output_layers=[-2])
clf = LogisticRegression()
# clf = SVC()