Here are the examples of the python api numpy.savetxt taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
693 Examples
5
Source : gmm_fit.py
with GNU General Public License v3.0
from cbg-ethz
with GNU General Public License v3.0
from cbg-ethz
def _write_estimates(self, outfile):
logger.info("Writing cluster weights/means/variances")
ccw = outfile + "_mixing_weights.tsv"
numpy.savetxt(ccw, self.__mixing_weights, delimiter="\t")
means = self.__estimates.select("mean").toPandas().values
varis = self.__estimates.select("cov").toPandas().values
for i in range(self.__estimates.count()):
ccm = outfile + "_means_{}.tsv".format(i)
ccv = outfile + "_variances_{}.tsv".format(i)
numpy.savetxt(ccm, means[i][0].values, delimiter="\t")
numpy.savetxt(ccv, varis[i][0].toArray(), delimiter="\t")
def _write_statistics(self, outfile):
5
Source : stumpyAlgorithm.py
with MIT License
from smartyal
with MIT License
from smartyal
def debug_help_vis(distance_profile, minimaRelPeakWD, idxSortDistProfMinimaExc):
numpy.savetxt("profile.txt", distance_profile, delimiter=',')
numpy.savetxt("minRelPeakWD.txt", minimaRelPeakWD, delimiter=',')
numpy.savetxt("idxSotedProfExc.txt", idxSortDistProfMinimaExc, delimiter=',')
return True
def stumpy_print_z_normalized_labeled_2_axis(querySeriesValues, timeSeriesValues, idx, label, varName):
3
Source : classification-with-confidence.py
with Apache License 2.0
from AbertayMachineLearningGroup
with Apache License 2.0
from AbertayMachineLearningGroup
def write_data_to_file(data, fileName):
with open(fileName, 'a') as cv_file:
cv_file.write('Number of predicted classes per instance\n')
np.savetxt(cv_file, data._count_of_classes_per_instance, delimiter=',', fmt='%1.3f')
cv_file.write('Number of instances hist (count of instances in each number of predicted classes per instances)\n')
np.savetxt(cv_file, data._hist_of_instances, delimiter=',', fmt='%1.3f')
cv_file.write('Related Classes\n')
np.savetxt(cv_file, data._related_classess, delimiter=',', fmt='%1.3f')
def main(data_file_path):
3
Source : io.py
with Apache License 2.0
from achao2013
with Apache License 2.0
from achao2013
def write_asc(path, vertices):
'''
Args:
vertices: shape = (nver, 3)
'''
if path.split('.')[-1] == 'asc':
np.savetxt(path, vertices)
else:
np.savetxt(path + '.asc', vertices)
def write_obj_with_colors(obj_name, vertices, colors, triangles):
3
Source : diag.py
with GNU General Public License v3.0
from adgproject
with GNU General Public License v3.0
from adgproject
def print_adj_matrices(directory, diagrams):
"""Print a computer-readable file with the diagrams' adjacency matrices.
Args:
directory (str): The path to the output directory.
diagrams (list): All the diagrams.
"""
with open(directory+"/adjacency_matrices.txt", "w") as mat_file:
for idx, diagram in enumerate(diagrams):
mat_file.write("Diagram n: %i\n" % (idx + 1))
numpy.savetxt(mat_file,
nx.to_numpy_matrix(diagram.graph, dtype=int),
fmt='%d')
mat_file.write("\n")
class Diagram(object):
3
Source : test_io.py
with GNU General Public License v3.0
from adityaprakash-bobby
with GNU General Public License v3.0
from adityaprakash-bobby
def test_0D_3D(self):
c = BytesIO()
assert_raises(ValueError, np.savetxt, c, np.array(1))
assert_raises(ValueError, np.savetxt, c, np.array([[[1], [2]]]))
def test_record(self):
3
Source : lobpcg.py
with GNU General Public License v3.0
from adityaprakash-bobby
with GNU General Public License v3.0
from adityaprakash-bobby
def save(ar, fileName):
# Used only when verbosity level > 10.
from numpy import savetxt
savetxt(fileName, ar, precision=8)
def _assert_symmetric(M, rtol=1e-5, atol=1e-8):
3
Source : create_videodata.py
with MIT License
from adswa
with MIT License
from adswa
def savefile(fixation_vector, output, header):
newheader = ''.join([w + '\t' for w in header]).strip()
np.savetxt(output, fixation_vector, delimiter='\t', comments='', header=newheader)
def run(data1, shots, sz, dur, subname):
3
Source : io.py
with GNU General Public License v3.0
from AFM-analysis
with GNU General Public License v3.0
from AFM-analysis
def export_training_set(self, path):
path = pathlib.Path(path)
path.mkdir(parents=True, exist_ok=True)
raters = rater.IndentationRater.get_feature_funcs()
samples = self.samples
for ii, rti in enumerate(raters):
rpath = path / "train_{}.txt".format(rti[0])
np.savetxt(rpath, samples[:, ii].flatten(), fmt="%.2e")
user = self.get_rates(which="user")
upath = str(path / "train_response.txt")
np.savetxt(upath, user.flatten(), fmt="%.2e")
def get_cross_validation_score(self, regressor, training_set=None,
3
Source : mpl_edelta.py
with GNU General Public License v3.0
from AFM-analysis
with GNU General Public License v3.0
from AFM-analysis
def save_data_callback(self, filename):
"""Save current image as tsv"""
with io.open(filename, "w") as fd:
fd.write("indentation depth [m]\telastic modulus [Pa]\n")
with io.open(filename, "ab") as fd:
np.savetxt(fd, self.plot_data, delimiter="\t")
def update(self, fdist, delta_opt=None):
3
Source : mpl_qmap.py
with GNU General Public License v3.0
from AFM-analysis
with GNU General Public License v3.0
from AFM-analysis
def save_data_callback(self, filename):
"""Save current image as tsv"""
with io.open(filename, "wb") as fd:
np.savetxt(fd, self.qmap_data, delimiter="\t")
def set_selection_by_coord(self, x, y):
3
Source : TensorCFR.py
with GNU General Public License v3.0
from aicenter
with GNU General Public License v3.0
from aicenter
def log_after_all_steps(tensorcfr_instance, session, average_infoset_strategies, log_dir_path):
print("###################################\n")
print_tensors(session, tensorcfr_instance.domain.cumulative_infoset_strategies)
print("___________________________________\n")
print_tensors(session, average_infoset_strategies)
print("Storing average strategies to '{}'...".format(log_dir_path))
for level in range(len(average_infoset_strategies)):
np.savetxt(
'{}/average_infoset_strategies_level_{}.csv'.format(log_dir_path, level),
session.run(average_infoset_strategies[level]),
delimiter=',',
)
def get_cfr_strategies(tensorcfr_instance: TensorCFR, total_steps=DEFAULT_TOTAL_STEPS, quiet=False, delay=DEFAULT_AVERAGING_DELAY,
3
Source : TensorCFRFixedTrunkStrategies.py
with GNU General Public License v3.0
from aicenter
with GNU General Public License v3.0
from aicenter
def store_final_average_strategies(self):
print_tensors(self.session, self.average_infoset_strategies)
print("Storing average strategies to '{}'...".format(self.log_directory))
for level in range(len(self.average_infoset_strategies)):
np.savetxt(
'{}/average_infoset_strategies_lvl{}.csv'.format(self.log_directory, level),
self.session.run(self.average_infoset_strategies[level]),
delimiter=',',
)
def store_trunk_info_of_infosets(self, dataset_basename, dataset_directory=""):
3
Source : TensorCFRFlattenedDomains.py
with GNU General Public License v3.0
from aicenter
with GNU General Public License v3.0
from aicenter
def log_after_all_steps(tensorcfr_instance, session, average_infoset_strategies, log_dir_path):
print("###################################\n")
print_tensors(session, tensorcfr_instance.domain.cumulative_infoset_strategies)
print("___________________________________\n")
print_tensors(session, average_infoset_strategies)
print("Storing average strategies to '{}'...".format(log_dir_path))
for level in range(len(average_infoset_strategies)):
np.savetxt(
'{}/average_infoset_strategies_level_{}.csv'.format(log_dir_path, level),
session.run(average_infoset_strategies[level]),
delimiter=',',
)
def get_cfr_strategies(tensorcfr_instance: TensorCFRFlattenedDomains, total_steps=DEFAULT_TOTAL_STEPS, quiet=False,
3
Source : DeepModel_AutoMPG.py
with MIT License
from AishwaryaSivaraman
with MIT License
from AishwaryaSivaraman
def update_batch (model, layer_size, batch_data, batch_label, data_dir, batch_size):
history=model.fit(batch_data, batch_label, epochs=1, batch_size=batch_size, validation_split = 0.2, verbose=0)
for i in range(layer_size):
weight = model.layers[i].get_weights()[0]
bias = model.layers[i].get_weights()[1]
np.savetxt(data_dir+"/weights_layer%d.csv"%(i),weight,delimiter=",")
np.savetxt(data_dir+"/bias_layer%d.csv"%(i),bias,delimiter=",")
return model
def output(model, datapoint):
3
Source : vscikit-learn.py
with MIT License
from alan-toledo
with MIT License
from alan-toledo
def main():
train_messages, train_labels = util.load_spam_dataset('spam_train.tsv')
test_messages, test_labels = util.load_spam_dataset('spam_test.tsv')
dictionary = create_dictionary(train_messages)
print('Size of dictionary: ', len(dictionary))
train_matrix = transform_text(train_messages, dictionary)
test_matrix = transform_text(test_messages, dictionary)
gnb = GaussianNB()
naive_bayes_predictions = gnb.fit(train_matrix, train_labels).predict(test_matrix)
np.savetxt('vscikit-learn_spam_naive_bayes_predictions', naive_bayes_predictions)
naive_bayes_accuracy = np.mean(naive_bayes_predictions == test_labels)
print('Naive Bayes had an accuracy of {} on the testing set'.format(naive_bayes_accuracy))
if __name__ == "__main__":
3
Source : pattern_generation.py
with MIT License
from alan-turing-institute
with MIT License
from alan-turing-institute
def save_as_csv(self, filename):
"""
Save the image as a csv file
"""
print(f'Saving file "{filename}"')
np.savetxt(filename, self.plant_biomass, delimiter=",", newline="\n", fmt="%f")
def save_as_matlab(self, filename):
3
Source : network.py
with MIT License
from alexanderrichard
with MIT License
from alexanderrichard
def save_model(self, network_file, length_file, prior_file):
self.net.cpu()
torch.save(self.net.state_dict(), network_file)
self.net.cuda()
np.savetxt(length_file, self.mean_lengths)
np.savetxt(prior_file, self.prior)
3
Source : logger.py
with BSD 2-Clause "Simplified" License
from andyzeng
with BSD 2-Clause "Simplified" License
from andyzeng
def save_camera_info(self, intrinsics, pose, depth_scale):
np.savetxt(os.path.join(self.info_directory, 'camera-intrinsics.txt'), intrinsics, delimiter=' ')
np.savetxt(os.path.join(self.info_directory, 'camera-pose.txt'), pose, delimiter=' ')
np.savetxt(os.path.join(self.info_directory, 'camera-depth-scale.txt'), [depth_scale], delimiter=' ')
def save_heightmap_info(self, boundaries, resolution):
3
Source : corpus.py
with MIT License
from Annusha
with MIT License
from Annusha
def save_embed_feat(self):
dir_check(ops.join(opt.data, 'embed'))
dir_check(ops.join(opt.data, 'embed', opt.subaction))
for video in self._videos:
video_features = self._embedded_feat[video.global_range]
feat_name = opt.resume_str + '_%s' % video.name
np.savetxt(ops.join(opt.data, 'embed', opt.subaction, feat_name), video_features)
3
Source : video.py
with MIT License
from Annusha
with MIT License
from Annusha
def save_likelihood(self):
"""Used for multiprocessing"""
dir_check(os.path.join(opt.data, 'likelihood'))
np.savetxt(os.path.join(opt.data, 'likelihood', self.name), self._likelihood_grid)
# print(os.path.join(opt.data, 'likelihood', self.name))
def load_likelihood(self):
3
Source : file_interface.py
with MIT License
from ArminMasoumian
with MIT License
from ArminMasoumian
def write_kitti_poses_file(file_path, traj, confirm_overwrite=False):
"""
:param file_path: desired text file for trajectory (string or handle)
:param traj: trajectory.PosePath3D or trajectory.PoseTrajectory3D
:param confirm_overwrite: whether to require user interaction
to overwrite existing files
"""
if isinstance(file_path, str) and confirm_overwrite:
if not user.check_and_confirm_overwrite(file_path):
return
# first 3 rows of SE(3) matrix flattened
poses_flat = [p.flatten()[:-4] for p in traj.poses_se3]
np.savetxt(file_path, poses_flat, delimiter=' ')
if isinstance(file_path, str):
logger.info("Poses saved to: " + file_path)
def read_euroc_csv_trajectory(file_path):
3
Source : generate_embeddings.py
with BSD 3-Clause "New" or "Revised" License
from arsfutura
with BSD 3-Clause "New" or "Revised" License
from arsfutura
def main():
torch.set_grad_enabled(False)
args = parse_args()
features_extractor = FaceFeaturesExtractor()
dataset = datasets.ImageFolder(args.input_folder)
embeddings, labels = dataset_to_embeddings(dataset, features_extractor)
dataset.class_to_idx = normalise_dict_keys(dataset.class_to_idx)
idx_to_class = {v: k for k, v in dataset.class_to_idx.items()}
labels = list(map(lambda idx: idx_to_class[idx], labels))
np.savetxt(args.output_folder + os.path.sep + 'embeddings.txt', embeddings)
np.savetxt(args.output_folder + os.path.sep + 'labels.txt', np.array(labels, dtype=np.str).reshape(-1, 1), fmt="%s")
joblib.dump(dataset.class_to_idx, args.output_folder + os.path.sep + 'class_to_idx.pkl')
if __name__ == '__main__':
3
Source : utils.py
with MIT License
from art-programmer
with MIT License
from art-programmer
def writeSemantics(filename, semantics):
""" Write semantics """
semantics = mapper[semantics]
np.savetxt(filename, semantics, fmt='%d')
return
def writeInstances(path, scene_id, instances, semantics, instance_info):
3
Source : pv_parseBruker_md_np.py
with GNU General Public License v3.0
from aswendtlab
with GNU General Public License v3.0
from aswendtlab
def writeRotMatrix(rotMatrix, filename):
fid = open(filename, 'w')
np.savetxt(fid, rotMatrix, fmt='%-7.2f')
fid.close()
"""
3
Source : results.py
with MIT License
from autonomio
with MIT License
from autonomio
def save_result(self):
'''SAVES THE RESULTS/PARAMETERS TO A CSV SPECIFIC TO THE EXPERIMENT'''
import numpy as np
np.savetxt(self._experiment_log,
self.result,
fmt='%s',
delimiter=',')
def result_todf(self):
3
Source : encoder.py
with Apache License 2.0
from aws
with Apache License 2.0
from aws
def _array_to_csv(array_like):
"""Convert an array-like object to CSV.
To understand better what an array-like object is see:
https://docs.scipy.org/doc/numpy/user/basics.creation.html#converting-python-array-like-objects-to-numpy-arrays
Args:
array_like (np.array or Iterable or int or float): array-like object
to be converted to CSV.
Returns:
(str): object serialized to CSV
"""
stream = StringIO()
np.savetxt(stream, array_like, delimiter=",", fmt="%s")
return stream.getvalue()
_encoder_map = {
3
Source : prediction_utils.py
with Apache License 2.0
from aws
with Apache License 2.0
from aws
def save(self) -> None:
"""Serialize predictions as .csv file in output data directory."""
self._check_output_path()
save_path = self._get_save_path()
logging.info(f"Storing predictions on validation set(s) in {save_path}")
np.savetxt(save_path, self._aggregate_predictions(), delimiter=',', fmt='%f')
3
Source : test_io.py
with Apache License 2.0
from aws-samples
with Apache License 2.0
from aws-samples
def test_0D_3D(self):
c = BytesIO()
assert_raises(ValueError, np.savetxt, c, np.array(1))
assert_raises(ValueError, np.savetxt, c, np.array([[[1], [2]]]))
def test_record(self):
3
Source : test_io.py
with Apache License 2.0
from awslabs
with Apache License 2.0
from awslabs
def test_0D_3D(self):
c = BytesIO()
assert_raises(ValueError, np.savetxt, c, np.array(1))
assert_raises(ValueError, np.savetxt, c, np.array([[[1], [2]]]))
def test_structured(self):
3
Source : curriculum.py
with MIT License
from BarisYazici
with MIT License
from BarisYazici
def log_step(self, model_dir):
with open(os.path.join(model_dir, 'curriculum_steps.csv'), 'ba') as f:
np.savetxt(f, [[self._policy_iteration, self._lambda]])
self._policy_iteration += 1
def _update_parameters(self):
3
Source : plot_utils.py
with MIT License
from benrhodes26
with MIT License
from benrhodes26
def five_stat_and_hist(x, name, save_dir):
np.savetxt(os.path.join(save_dir, "ratio_{}_5statsum.txt".format(name)),
_five_stat_sum(x), header="mean/median/std/min/max")
plot_hist_marginals_and_scatter(x)
save_fig(save_dir, "ratio_{}_histogram".format(name))
def _five_stat_sum(x):
3
Source : run_all_benchmarks.py
with GNU General Public License v3.0
from berndporr
with GNU General Public License v3.0
from berndporr
def run_MIT_tests():
# MIT-BIH database testing
mit_test = MITDB_test()
mit_detectors = Detectors(360)
# test single detector
matched_filter_mit = mit_test.single_classifier_test(mit_detectors.matched_filter_detector, tolerance=0)
np.savetxt('matched_filter_mit.csv', matched_filter_mit, fmt='%i', delimiter=',')
# test all detectors on MITDB, will save results to csv, will take some time
mit_test.classifer_test_all()
if do_test_MIT:
3
Source : xyz.py
with MIT License
from BingqingCheng
with MIT License
from BingqingCheng
def write_computed_descriptors(self, filename, desc_dict_keys=[], sbs=[], comment=''):
"""
write the computed descriptors for selected frames
Parameters
----------
desc_spec_keys: list
a list (str-like) of keys for which computed descriptors to fetch.
sbs: array, integer
Returns
-------
desc: np.matrix [n_frame, n_desc]
"""
if len(sbs) == 0:
sbs = range(self.nframes)
np.savetxt(str(filename) + ".desc", self.fetch_computed_descriptors(desc_dict_keys, sbs), fmt='%4.8f',
header=comment)
3
Source : write.py
with Apache License 2.0
from bleakie
with Apache License 2.0
from bleakie
def write_asc(path, vertices):
'''
Args:
vertices: shape = (nver, 3)
'''
if path.split('.')[-1] == 'asc':
np.savetxt(path, vertices)
else:
np.savetxt(path + '.asc', vertices)
def write_obj_with_colors(obj_name, vertices, triangles, colors):
3
Source : test_serializers.py
with GNU General Public License v3.0
from bootphon
with GNU General Public License v3.0
from bootphon
def test_csvserializer_badheader(tmpdir, mfcc_col):
# no header at all
filename = str(tmpdir.join('foo.csv'))
np.savetxt(filename, mfcc_col['mfcc'].data)
with pytest.raises(ValueError) as err:
FeaturesCollection.load(tmpdir, serializer='csv')
assert 'failed to parse header' in str(err.value)
def test_csvserializer_corruptedheader(tmpdir, mfcc_col):
3
Source : test_serializers.py
with GNU General Public License v3.0
from bootphon
with GNU General Public License v3.0
from bootphon
def test_csvserializer_corruptedheader(tmpdir, mfcc_col):
# corrupted header
filename = str(tmpdir.join('foo.csv'))
np.savetxt(
filename, mfcc_col['mfcc'].data, header='data_dtype', comments='# ')
with pytest.raises(ValueError) as err:
FeaturesCollection.load(tmpdir, serializer='csv')
assert 'failed to parse header' in str(err.value)
def test_csvserializer_bad(tmpdir, mfcc_col):
3
Source : get_all_spaces.py
with BSD 3-Clause "New" or "Revised" License
from BorgwardtLab
with BSD 3-Clause "New" or "Revised" License
from BorgwardtLab
def save_all(data, labels, name):
os.makedirs(f'bottleneck/{name}', exist_ok=True)
np.savetxt(f'bottleneck/{name}/data.csv', data, delimiter=',')
np.savetxt(f'bottleneck/{name}/labels.csv', labels, delimiter=',')
if __name__ == '__main__':
3
Source : compute_persistence_post_hoc.py
with BSD 3-Clause "New" or "Revised" License
from BorgwardtLab
with BSD 3-Clause "New" or "Revised" License
from BorgwardtLab
def save_all(data, latents, labels):
np.savetxt("csv/data.csv", data, delimiter=",")
np.savetxt("csv/latents.csv", latents, delimiter=",")
np.savetxt("csv/labels.csv", labels, delimiter=",")
def topo_magic(data, latents):
3
Source : alpha.py
with MIT License
from bruel-gabrielsson
with MIT License
from bruel-gabrielsson
def save_csvs(problem, pen, lam, mse, be):
fname = 'results2/alpha_' + problem + '_mses_' + pen + '.csv'
np.savetxt(fname, mse, delimiter=',')
fname = 'results2/alpha_' + problem + '_bes_' + pen + '.csv'
np.savetxt(fname, be, delimiter=',')
fname = 'results2/alpha_' + problem + '_lam_' + pen + '.csv'
np.savetxt(fname, lam, delimiter=',')
problem = '123'
3
Source : levelset.py
with MIT License
from bruel-gabrielsson
with MIT License
from bruel-gabrielsson
def save_csvs(problem, pen, mses, qs, lamopt):
fname = 'results/' + problem + '_mses_' + pen + '.csv'
np.savetxt(fname, mses, delimiter=',')
fname = 'results/' + problem + '_qs_' + pen + '.csv'
np.savetxt(fname, qs, delimiter=',')
fname = 'results/' + problem + '_lam_' + pen + '.csv'
np.savetxt(fname, lamopt, delimiter=',')
beta0 = generate_sinusoid(p, 3)
3
Source : rips.py
with MIT License
from bruel-gabrielsson
with MIT License
from bruel-gabrielsson
def save_csvs(problem, pen, mses, qs, lamopt):
fname = 'results/rips_' + problem + '_mses_' + pen + '.csv'
np.savetxt(fname, mses, delimiter=',')
fname = 'results/rips_' + problem + '_qs_' + pen + '.csv'
np.savetxt(fname, qs, delimiter=',')
fname = 'results/rips_' + problem + '_lam_' + pen + '.csv'
np.savetxt(fname, lamopt, delimiter=',')
problem = '123'
3
Source : test_rf_dataset.py
with Apache License 2.0
from bsc-wdc
with Apache License 2.0
from bsc-wdc
def _fill_targets_file(targets_path, row_blocks):
rows_targets = Array._merge_blocks(row_blocks)
with open(targets_path, "at") as f:
np.savetxt(f, rows_targets, fmt="%s", encoding="utf-8")
def save_samples(x, samples_path, fortran_order):
3
Source : data_generator.py
with GNU General Public License v3.0
from BSifringer
with GNU General Public License v3.0
from BSifringer
def saveFile(fileName, data, headers):
file = open(fileName, 'wb')
np.savetxt(file, data, fmt='%10.5f', header=headers, delimiter = '\t', comments='')
file.close()
def single_run(n, i, coeff, *args):
3
Source : synth_data_generator.py
with GNU General Public License v3.0
from BSifringer
with GNU General Public License v3.0
from BSifringer
def saveFile(fileName, data, headers):
file = open(fileName, 'wb')
np.savetxt(file, data, fmt='%10.5f', header=headers, delimiter='\t', comments='')
file.close()
def single_run(n, i, coeff, *args):
3
Source : export.py
with GNU General Public License v3.0
from btobers
with GNU General Public License v3.0
from btobers
def dat(fpath, dat):
np.savetxt(fpath, dat, fmt="%s", delimiter=",")
print("data exported successfully:\t" + fpath)
# log is a method to export the processing log as a python script
def log(fpath, log):
3
Source : lobpcg.py
with MIT License
from buds-lab
with MIT License
from buds-lab
def _save(ar, fileName):
# Used only when verbosity level > 10.
np.savetxt(fileName, ar)
def _report_nonhermitian(M, a, b, name):
3
Source : scanner.py
with MIT License
from CEMES-CNRS
with MIT License
from CEMES-CNRS
def save_txt(self):
fname = gutils.select_file(start_path=None, save=True, ext='dat')
if fname is not None and fname != '':
np.savetxt(fname, self.get_data_all(), delimiter='\t')
def __repr__(self):
3
Source : audio_dataset.py
with MIT License
from chaosparrot
with MIT License
from chaosparrot
def feature_engineering_cached(self, filename, rebuild_cache=False):
# Only build a filesystem cache of feature engineering results if we are dealing with non-raw wave form
if (self.settings['FEATURE_ENGINEERING_TYPE'] != 1):
cached_filename = filename + "_fe";
if (os.path.isfile(cached_filename) == False or rebuild_cache == True):
data_row = training_feature_engineering(filename, self.settings)
np.savetxt( cached_filename, data_row )
else:
cached_filename = filename
return np.loadtxt( cached_filename, dtype='float' )
def feature_engineering_augmented(self, filename):
3
Source : iter_counter.py
with MIT License
from ChaoyueSong
with MIT License
from ChaoyueSong
def record_epoch_end(self):
current_time = time.time()
self.time_per_epoch = current_time - self.epoch_start_time
print('End of epoch %d / %d \t Time Taken: %d sec' %
(self.current_epoch, self.total_epochs, self.time_per_epoch))
if self.current_epoch % self.opt.save_epoch_freq == 0:
np.savetxt(self.iter_record_path, (self.current_epoch + 1, 0),
delimiter=',', fmt='%d')
print('Saved current iteration count at %s.' % self.iter_record_path)
def record_current_iter(self):
See More Examples