PyTorch Tutorialweights Evaluate Model •Visualise Tensor • Tensor? • PyTorch Tensors are just like numpy arrays, but they can run on GPU. • Examples: And more operations like: Indexing, slicing, reshape, transpose grad_fn – history of operations for autograd • t.grad_fn Loading Data, Devices and CUDA • Numpy arrays to PyTorch tensors • torch.from_numpy(x_train) • Returns a cpu tensor! • PyTorch tensor to numpy0 码力 | 38 页 | 4.09 MB | 1 年前3
机器学习课程-温州大学-Scikit-learnmetrics import r2_score 基本建模流程 9 2.Scikit-learn主要用法 ✓Scikit-learn支持以NumPy的arrays对象、Pandas对象、SciPy的稀 疏 矩阵及其他可转换为数值型arrays的数据结构作为其输入,前提是 数据必须是数值型的 ✓sklearn.datasets模块提供了一系列加载和获取著名数据集如鸢尾 花、波士顿房价、Olive0 码力 | 31 页 | 1.18 MB | 1 年前3
keras tutorialTheano Theano is an open source deep learning library that allows you to evaluate multi- dimensional arrays effectively. We can easily install using the below command: pip install theano By default, keras 'dense_15/BiasAdd:0' shape=(?, 8) dtype=float32>] model.get_weights - Returns all the weights as NumPy arrays. model.set_weights(weight_numpy_array) - Set the weights of the model. Serialize the model categorical_accuracy Keras 63 Model Training Models are trained by NumPy arrays using fit(). The main purpose of this fit function is used to evaluate your model on training. This0 码力 | 98 页 | 1.57 MB | 1 年前3
Keras: 基于 Python 的深度学习库History 对象。 异常 • RuntimeError: 如果模型从未编译。 例 def generate_arrays_from_file(path): while 1: f = open(path) for line in f: # create Numpy arrays of input data # and labels, from each line in the file file x, y = process_line(line) yield (x, y) 模型 47 f.close() model.fit_generator(generate_arrays_from_file('/my_file.txt'), steps_per_epoch=1000, epochs=10) 4.2.3.9 evaluate_generator evaluate_generator(self utils.Sequence) 实 例同用。 • initial_epoch: 开始训练的轮次(有助于恢复之前的训练)。 返回 一个 History 对象。 例 def generate_arrays_from_file(path): while 1: f = open(path) for line in f: # 从文件中的每一行生成输入数据和标签的 numpy 数组, x1, x20 码力 | 257 页 | 1.19 MB | 1 年前3
《TensorFlow 快速入门与实战》5-实战TensorFlow手写体数字识别Arguments: • path:本地缓存 MNIST 数据集(mnist.npz)的相对路径(~/.keras/datasets) Returns: Tuple of Numpy arrays: `(x_train, y_train), (x_test, y_test)`. MNIST 数据集 样例可视化 MNIST Softmax 网络介绍 感知机模型 1957年,受 Warren0 码力 | 38 页 | 1.82 MB | 1 年前3
Machine Learning Pytorch Tutorial__getitem__(2) __getitem__(3) __getitem__(4) 0 1 2 3 4 Tensors ● High-dimensional matrices (arrays) 1-D tensor e.g. audio 2-D tensor e.g. black&white images 3-D tensor e.g. RGB images Tensors0 码力 | 48 页 | 584.86 KB | 1 年前3
动手学深度学习 v2.0否希望数据迭代器对象在每个迭代周期内打乱数据。 def load_array(data_arrays, batch_size, is_train=True): #@save """构造一个PyTorch数据迭代器""" dataset = data.TensorDataset(*data_arrays) return data.DataLoader(dataset, batch_size, num_steps) data_arrays = (src_array, src_valid_len, tgt_array, tgt_valid_len) (continues on next page) 362 9. 现代循环神经网络 (continued from previous page) data_iter = d2l.load_array(data_arrays, batch_size)0 码力 | 797 页 | 29.45 MB | 1 年前3
共 7 条
- 1













