numpy.savetxt - python examples

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.

145 Examples 7

3 View Complete Implementation : ingest_flower102.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : cs-chan
    def run(self):
        """
        resize images then write manifest files to disk.
        """
        self.write_label()
        self.collectdata()

        records = [(fname, tgt)
                   for fname, tgt in self.trainpairlist.items()]
        np.savetxt(self.manifests['train'], records, fmt='%s,%s')

        records = [(fname, tgt)
                   for fname, tgt in self.valpairlist.items()]
        np.savetxt(self.manifests['val'], records, fmt='%s,%s')

        records = [(fname, tgt)
                   for fname, tgt in self.testpairlist.items()]
        np.savetxt(self.manifests['test'], records, fmt='%s,%s')

3 View Complete Implementation : ingest_stl10.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : cs-chan
    def run(self):
        """
        resize images then write manifest files to disk.
        """
        self.write_label()
        self.collectdata()

        records = [(fname, tgt)
                   for fname, tgt in self.trainpairlist.items()]
        np.savetxt(self.manifests['train'], records, fmt='%s,%s')

        records = [(fname, tgt)
                   for fname, tgt in self.valpairlist.items()]
        np.savetxt(self.manifests['val'], records, fmt='%s,%s')

3 View Complete Implementation : ingest_stl10.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : cs-chan
    def run(self):
        """
        resize images then write manifest files to disk.
        """
        self.write_label()
        self.collectdata()

        records = [(fname, tgt)
                   for fname, tgt in self.trainpairlist.items()]
        np.savetxt(self.manifests, records, fmt='%s,%s')

3 View Complete Implementation : ingest_cub200.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : cs-chan
    def run(self):
        """
        resize images then write manifest files to disk.
        """
        self.write_label()
        self.collectdata()

        records = [(fname, tgt)
                   for fname, tgt in self.trainpairlist.items()]
        np.savetxt(self.manifests['train'], records, fmt='%s,%s')

        records = [(fname, tgt)
                   for fname, tgt in self.valpairlist.items()]
        np.savetxt(self.manifests['val'], records, fmt='%s,%s')

3 View Complete Implementation : ingest_wikiart.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : cs-chan
    def run(self):
        """
        resize images then write manifest files to disk.
        """
        self.write_label()
        self.collectdata()

        records = [(fname, tgt)
                   for fname, tgt in self.trainpairlist.items()]
        np.savetxt(self.manifests['train'], records, fmt='%s,%s')

        records = [(fname, tgt)
                   for fname, tgt in self.valpairlist.items()]
        np.savetxt(self.manifests['val'], records, fmt='%s,%s')

3 View Complete Implementation : eval_util.py
Copyright MIT License
Author : djp42
def wrap_plot(plot_type, actuals, predictions, features, satle, savepath, mean, stdev):
    this_satle = satle + "_" + plot_type
    if plot_type == "Confusion":
        heights = makeConfusionMatrix(actuals, predictions, satle=this_satle, savepath=savepath)
        np.savetxt(savepath+satle+"_Confusion-heights", heights)
    elif plot_type == "DistanceH":
        accuracy_cords, count_cords = makeDistanceHistogram(actuals, predictions, features,
                                          mean, stdev, satle=this_satle, savepath=savepath)
        np.savetxt(savepath+satle+"_DistanceH-accuracies", accuracy_cords)
        np.savetxt(savepath+satle+"_DistanceH-counts", count_cords)
    elif plot_type == "Lanetype":
        accuracy_cords, count_cords, entries = makeLaneBar(actuals, predictions, features,
                                          mean, stdev, satle=this_satle, savepath=savepath)
        np.savetxt(savepath+satle+"_Lanetype-accuracies", accuracy_cords)
        np.savetxt(savepath+satle+"_Lanetype-counts", count_cords)
        np.savetxt(savepath+satle+"_Lanetype-entries", entries, fmt="%s")
    else:
        print("Plot type", plot_type, "is unsupported.")
    return

3 View Complete Implementation : learn_util.py
Copyright MIT License
Author : djp42
def saveSparse(filepath, X):
    if X.shape == (0,):
        return
    data = X.data
    indices = X.indices
    indptr = X.indptr
    np.savetxt(filepath + '-data',data)
    np.savetxt(filepath + '-indices',indices)
    np.savetxt(filepath + '-indptr',indptr)

3 View Complete Implementation : nn_words.py
Copyright GNU Affero General Public License v3.0
Author : gulp21
    def save_weights(self, output_path):
        if self.use_conv_layer:
            nn.write_4dmat(output_path + "/W_conv1.txt", tf.transpose(self.W_conv1, (3, 0, 1, 2)).eval())
            nn.write_4dmat(output_path + "/b_conv1.txt", self.b_conv1.eval())
        else:
            np.savetxt(output_path + "/W_fc1.txt", self.W_fc1.eval())
            np.savetxt(output_path + "/b_fc1.txt", self.b_fc1.eval())
        if self.use_hidden_layer or self.use_conv_layer:
            np.savetxt(output_path + "/b_fc2.txt", self.b_fc2.eval())
            np.savetxt(output_path + "/W_fc2.txt", self.W_fc2.eval())

3 View Complete Implementation : learn_util.py
Copyright MIT License
Author : djp42
def saveExampleData(filename,Xtrain,ytrain,Xtest,ytest, mean_centered, predict):
    filepath_Xtrain = makeFullPath(filename, '-Xtrain'+str(mean_centered))
    saveSparse(filepath_Xtrain, Xtrain)
    filepath_ytrain = makeFullPath(filename, '-ytrain'+str(mean_centered))
    np.savetxt(filepath_ytrain, ytrain)
    filepath_Xtest = makeFullPath(filename, '-Xtest'+str(mean_centered)+predict)
    saveSparse(filepath_Xtest, Xtest)
    filepath_ytest = makeFullPath(filename, '-ytest'+str(mean_centered)+predict)
    np.savetxt(filepath_ytest, ytest)

3 View Complete Implementation : gater_seq.py
Copyright MIT License
Author : krishnakalyan3
    @staticmethod
    def save_targets(split_buckets):
        sd = {}
        for k, v in split_buckets.items():
            for val in v:
                sd[val] = k
        expert_array = []
        for k1 in sorted(sd):
            expert_array.append(sd[k1])

        np.savetxt('temp/vis_final_10' + '.csv', expert_array, delimiter=",")
        return 0