|
3 | 3 | import time
|
4 | 4 | import logging
|
5 | 5 | import argparse
|
6 |
| -import random |
7 | 6 | import numpy as np
|
8 | 7 | import pandas as pd
|
9 | 8 | from sklearn.impute import SimpleImputer
|
@@ -195,10 +194,6 @@ def train_type_classifier(x, y, batch_size=256, epochs=2, verbose=1):
|
195 | 194 | return model
|
196 | 195 |
|
197 | 196 |
|
198 |
| -def evaluate_model(model, df): |
199 |
| - return model.evaluate(x, y, batch_size=256) |
200 |
| - |
201 |
| - |
202 | 197 | def covariance(x, y):
|
203 | 198 | return K.mean(x * y) - K.mean(x) * K.mean(y)
|
204 | 199 |
|
@@ -387,7 +382,7 @@ def main():
|
387 | 382 | end = time.time()
|
388 | 383 | print(f'Done in {end-start:.3f} seconds ({args.n_samples/(end-start):.1f} samples/s).')
|
389 | 384 |
|
390 |
| - print(f'\nTrain a type classifier with synthetic data:') |
| 385 | + print('\nTrain a type classifier with synthetic data:') |
391 | 386 | x_new = np.concatenate((x_train, samples), axis=0)
|
392 | 387 | y_new = np.concatenate((y_train, c_sample), axis=0)
|
393 | 388 | xy = np.concatenate((x_new, y_new), axis=1)
|
@@ -422,7 +417,7 @@ def main():
|
422 | 417 | matplotlib.use('Agg')
|
423 | 418 | import matplotlib.pyplot as plt
|
424 | 419 | title = f'Type classifier accuray on holdout data ({args.top_k_types} types)'
|
425 |
| - fig = plt.figure(dpi=300) |
| 420 | + plt.figure(dpi=300) |
426 | 421 | ax = df.plot(title=title, ax=plt.gca(), xticks=[1, 5, 10, 15, 20])
|
427 | 422 | ax.set_ylim(0.35, 1)
|
428 | 423 | prefix = f'test-accuracy-comparison-{args.top_k_types}-types'
|
|
0 commit comments