MCPcopy Create free account

hub / github.com/ddbourgin/numpy-ml / functions

Functions1,202 in github.com/ddbourgin/numpy-ml

↓ 62 callersFunctionrandom_tensor
Create a random real-valued tensor of shape `shape`. If `standardize` is True, ensure each column has mean 0 and std 1.
numpy_ml/utils/testing.py:77
↓ 40 callersFunctiontorchify
(var, requires_grad=True)
numpy_ml/tests/nn_torch_models.py:17
↓ 30 callersMethodbackward
(self, out, **kwargs)
numpy_ml/neural_nets/modules/modules.py:37
↓ 26 callersMethodgrad
Compute the gradient of the VLB with regard to the network parameters. Parameters ---------- y : :py:class:`ndarray
numpy_ml/neural_nets/losses/losses.py:296
↓ 25 callersMethodbackward
(grad_output)
numpy_ml/tests/nn_torch_models.py:134
↓ 24 callersFunctionerr_fmt
(params, golds, ix, warn_str="")
numpy_ml/tests/test_nn.py:64
↓ 23 callersMethodact_fn
The activation function for the base layer.
numpy_ml/neural_nets/wrappers/wrappers.py:73
↓ 22 callersMethodforward
(self, z, **kwargs)
numpy_ml/neural_nets/modules/modules.py:33
↓ 21 callersMethod__init__
A Restricted Boltzmann machine with Bernoulli visible and hidden units. Parameters ---------- n_out : int
numpy_ml/neural_nets/layers/layers.py:366
↓ 21 callersMethod__init__
(self)
numpy_ml/tests/nn_torch_models.py:52
↓ 19 callersMethodpredict
Use the trained decision tree to classify or predict the examples in `X`. Parameters ---------- X : :py:class:`ndarr
numpy_ml/trees/dt.py:87
↓ 16 callersMethodfit
Fit a binary decision tree to a dataset. Parameters ---------- X : :py:class:`ndarray <numpy.ndarray>` of shape `(N,
numpy_ml/trees/dt.py:70
↓ 15 callersFunctionloss
(yp, y)
numpy_ml/tests/test_trees.py:88
↓ 13 callersFunctionpad2D
Zero-pad a 4D input volume `X` along the second and third dimensions. Parameters ---------- X : :py:class:`ndarray <numpy.ndarray>`
numpy_ml/neural_nets/utils/utils.py:252
↓ 12 callersMethod__init__
r""" An exponential linear unit (ELU). Notes ----- ELUs are intended to address the fact that ReLUs are strictly nonn
numpy_ml/neural_nets/activations/activations.py:413
↓ 12 callersMethodcopy
Return a copy of the current object.
numpy_ml/neural_nets/schedulers/schedulers.py:27
↓ 12 callersFunctionlogsumexp
Redefine scipy.special.logsumexp see: http://bayesjumping.net/log-sum-exp-trick/
numpy_ml/utils/misc.py:5
↓ 11 callersMethodreset
Reset the bandit step and action counters to zero.
numpy_ml/bandits/bandits.py:69
↓ 10 callersMethodgradients
Return a dictionary of the gradients computed during the backward pass
numpy_ml/neural_nets/layers/layers.py:4201
↓ 10 callersMethodpredict
r""" Generate predictions for the targets associated with the rows in `X`. Parameters ---------- X : numpy array of s
numpy_ml/nonparametric/knn.py:62
↓ 10 callersMethodpredict
Use the trained model to generate predictions on a new collection of data points. Parameters ---------- X :
numpy_ml/linear_models/linear_regression.py:218
↓ 10 callersMethodtrain
Train the LDA model on a corpus of documents (bags of words). Parameters ---------- corpus : list of length `D`
numpy_ml/lda/lda.py:206
↓ 9 callersFunctionrandom_stochastic_matrix
Create a random stochastic matrix of shape (`n_examples`, `n_classes`)
numpy_ml/utils/testing.py:70
↓ 9 callersMethodstep
Increment the optimizer step counter by 1
numpy_ml/neural_nets/optimizers/optimizers.py:25
↓ 8 callersMethodfn
r""" Evaluate the ELU activation on the elements of input `z`. .. math:: \text{ELU}(z_i) &= z_i \ \ \ \
numpy_ml/neural_nets/activations/activations.py:449
↓ 8 callersFunctiontorch_gradient_generator
(fn, **kwargs)
numpy_ml/tests/test_nn_activations.py:14
↓ 7 callersMethodfit
r""" Fit regression coefficients via maximum likelihood. Parameters ---------- X : :py:class:`ndarray <numpy.ndarray>
numpy_ml/linear_models/linear_regression.py:172
↓ 7 callersMethodflush_gradients
Erase all the layer's derived variables and gradients.
numpy_ml/neural_nets/layers/layers.py:4244
↓ 7 callersFunctionis_number
Check that a value `a` is numeric
numpy_ml/utils/testing.py:38
↓ 7 callersMethodpop
Remove the item with the largest/smallest (depending on ``self.heap_order``) priority from the queue and return it. Notes
numpy_ml/utils/data_structures.py:127
↓ 6 callersFunctionReLULayer
(name, n_in, n_out, inputs, w_initialization)
numpy_ml/tests/nn_torch_models.py:1846
↓ 6 callersMethod__init__
(self, rewards, reward_probs, context=None)
numpy_ml/bandits/bandits.py:11
↓ 6 callersFunctioncalc_pad_dims_2D
Compute the padding necessary to ensure that convolving `X` with a 2D kernel of shape `kernel_shape` and stride `stride` produces outputs wit
numpy_ml/neural_nets/utils/utils.py:51
↓ 6 callersMethodencode
Encode a collection of multi-featured examples into a `n_dim`-dimensional feature matrix via feature hashing. Notes
numpy_ml/preprocessing/general.py:301
↓ 6 callersMethodfit
r""" Fit the model to the data and targets in `X` and `y` Parameters ---------- X : numpy array of shape `(N, M)`
numpy_ml/nonparametric/knn.py:47
↓ 6 callersFunctionpad1D
Zero-pad a 3D input volume `X` along the second dimension. Parameters ---------- X : :py:class:`ndarray <numpy.ndarray>` of shape `(
numpy_ml/neural_nets/utils/utils.py:195
↓ 6 callersFunctiontorch_gradient_generator
(fn, **kwargs)
numpy_ml/tests/nn_torch_models.py:21
↓ 6 callersMethodupdate
r""" Update the agent parameters according to the rewards accrued on the current episode. Returns ------- avg
numpy_ml/rl_models/agents.py:87
↓ 5 callersMethod__init__
The variational lower bound for a variational autoencoder with Bernoulli units. Notes ----- The VLB to the s
numpy_ml/neural_nets/losses/losses.py:226
↓ 5 callersMethodflush_history
Clear the episode history
numpy_ml/rl_models/agents.py:40
↓ 5 callersMethodforward
Perform the CD-`k` "forward pass" of visible inputs into hidden units and back. Notes ----- This implementat
numpy_ml/neural_nets/layers/layers.py:468
↓ 5 callersMethodforward
(self, X)
numpy_ml/tests/nn_torch_models.py:1477
↓ 5 callersMethodget_neighbors
Return the internal indices of the vertices reachable from the vertex with index `v_i`.
numpy_ml/utils/graphs.py:83
↓ 5 callersFunctiontokenize_words
Split a string into individual words, optionally removing punctuation and stop-words in the process.
numpy_ml/preprocessing/nlp.py:77
↓ 5 callersMethodupdate
Update the layer parameters using the accrued gradients and layer optimizer. Flush all gradients once the update is complete.
numpy_ml/neural_nets/layers/layers.py:4248
↓ 4 callersMethod__init__
(self)
numpy_ml/neural_nets/modules/modules.py:22
↓ 4 callersMethod__init__
Abstract base class for all Scheduler objects.
numpy_ml/neural_nets/schedulers/schedulers.py:20
↓ 4 callersMethod__init__
(self, env)
numpy_ml/rl_models/agents.py:13
↓ 4 callersMethod__init__
r""" A UCB1 policy for multi-armed bandit problems. Notes ----- The UCB1 algorithm [*]_ guarantees the cumulative reg
numpy_ml/bandits/policies.py:188
↓ 4 callersMethod_create_2num_dicts
(self, obs_encoder=None, act_encoder=None)
numpy_ml/rl_models/agents.py:21
↓ 4 callersMethodbackward
Perform a gradient update on the layer parameters via the contrastive divergence equations. Parameters ----------
numpy_ml/neural_nets/layers/layers.py:563
↓ 4 callersFunctioncalc_fan
Compute the fan-in and fan-out for a weight matrix/volume. Parameters ---------- weight_shape : tuple The dimensions of the
numpy_ml/neural_nets/utils/utils.py:352
↓ 4 callersFunctionconv2D
A faster (but more memory intensive) implementation of the 2D "convolution" (technically, cross-correlation) of input `X` with a collection o
numpy_ml/neural_nets/utils/utils.py:603
↓ 4 callersFunctiondg
E[log X_t] where X_t ~ Dir
numpy_ml/lda/lda.py:255
↓ 4 callersMethodfilter
Filter (or replace) any word in `words` that is not present in `Vocabulary`. Parameters ---------- words : l
numpy_ml/preprocessing/nlp.py:1105
↓ 4 callersMethodfn
r""" Evaluate the logistic sigmoid, :math:`\sigma`, on the elements of input `z`. .. math:: \sigma(x_i) = \frac{1}{1 + e
numpy_ml/neural_nets/activations/activations.py:39
↓ 4 callersMethodforward
Perform the forward pass for either the generator or the critic. Parameters ---------- X : :py:class:`ndarray <numpy
numpy_ml/neural_nets/models/wgan_gp.py:206
↓ 4 callersFunctionim2col
Pads and rearrange overlapping windows of the input volume into column vectors, returning the concatenated padded vectors in a matrix `X_col`
numpy_ml/neural_nets/utils/utils.py:486
↓ 4 callersMethodlog_prob
r""" Compute the smoothed log probability of a sequence of words under the `N`-gram language model with additive smoothing. N
numpy_ml/ngram/ngram.py:402
↓ 4 callersMethodloss
Variational lower bound for a Bernoulli VAE. Parameters ---------- y : :py:class:`ndarray <numpy.ndarray>` of shape
numpy_ml/neural_nets/losses/losses.py:261
↓ 4 callersFunctionngrams
Return all `N`-grams of the elements in `sequence`
numpy_ml/preprocessing/nlp.py:58
↓ 4 callersFunctionparam
A wrapper for `tf.Variable` which enables parameter sharing in models. Creates and returns theano shared variables similarly to `tf.Variable
numpy_ml/tests/nn_torch_models.py:1816
↓ 4 callersMethodpredict
Return the MAP estimate for :math:`y^*`, corresponding the mean/mode of the posterior predictive distribution, :math:`p(y^* \mid x^*,
numpy_ml/nonparametric/gp.py:64
↓ 4 callersMethodpredict
Generate predictions for the targets associated with the rows in `X`. Parameters ---------- X : :py:class:`ndarray <
numpy_ml/nonparametric/kernel_regression.py:53
↓ 4 callersMethodpredict
Return the MAP prediction for the targets associated with `X`. Parameters ---------- X : :py:class:`ndarray <numpy.n
numpy_ml/linear_models/bayesian_regression.py:139
↓ 4 callersMethodpredict
Return the MAP prediction for the targets associated with `X`. Parameters ---------- X : :py:class:`ndarray <numpy.n
numpy_ml/linear_models/bayesian_regression.py:276
↓ 4 callersMethodpredict
Predict the target value for each entry in `X`. Parameters ---------- X : :py:class:`ndarray <numpy.ndarray>` of sha
numpy_ml/trees/rf.py:61
↓ 4 callersMethodpredict
Use the trained model to classify or predict the examples in `X`. Parameters ---------- X : :py:class:`ndarray <nump
numpy_ml/trees/gbdt.py:158
↓ 4 callersFunctionrandom_one_hot_matrix
Create a random one-hot matrix of shape (`n_examples`, `n_classes`)
numpy_ml/utils/testing.py:63
↓ 4 callersFunctionrandom_paragraph
Generate a random paragraph consisting of `n_words` words. If `vocab` is not None, words will be drawn at random from this list. Otherwise, w
numpy_ml/utils/testing.py:99
↓ 4 callersFunctionrandom_unweighted_graph
Generate an unweighted Erdős-Rényi random graph [*]_. References ---------- .. [*] Erdős, P. and Rényi, A. (1959). On Random Graphs,
numpy_ml/utils/graphs.py:302
↓ 4 callersMethodsample
Sample functions from the GP prior or posterior predictive distribution. Parameters ---------- X : :py:class
numpy_ml/nonparametric/gp.py:223
↓ 4 callersFunctionto_networkx
Convert my graph representation to a networkx graph
numpy_ml/tests/test_utils.py:241
↓ 4 callersMethodtrain
Train an agent on an OpenAI gym environment, logging training statistics along the way. Parameters ----------
numpy_ml/rl_models/trainer.py:33
↓ 4 callersMethodupdate
(self, cur_loss=None)
numpy_ml/neural_nets/modules/modules.py:58
↓ 4 callersMethodupdate
Perform gradient updates and flush gradients upon completion
numpy_ml/neural_nets/models/wgan_gp.py:436
↓ 3 callersFunctionDiscriminator
(inputs, params=None)
numpy_ml/tests/nn_torch_models.py:1901
↓ 3 callersMethod__init__
A stochastic gradient descent optimizer. Notes ----- For model parameters :math:`\\theta`, averaged parameter gradie
numpy_ml/neural_nets/optimizers/optimizers.py:59
↓ 3 callersMethod__init__
Radial basis function (RBF) / squared exponential kernel. Notes ----- For input vectors :math:`\mathbf{x}` and :math
numpy_ml/utils/kernels.py:185
↓ 3 callersMethod__init__
A simple, unsmoothed N-gram model. Parameters ---------- N : int The maximum length (in words) of the co
numpy_ml/ngram/ngram.py:314
↓ 3 callersMethod_log_prob
Calculate the log probability of a sequence of words under the `N`-gram model
numpy_ml/ngram/ngram.py:255
↓ 3 callersMethod_traverse
(self, X, node, prob=False)
numpy_ml/trees/dt.py:205
↓ 3 callersMethodbackward
Perform the backward pass for either the generator or the critic. Parameters ---------- grad : :py:class:`ndarray <n
numpy_ml/neural_nets/models/wgan_gp.py:246
↓ 3 callersFunctioncol2im
Take columns of a 2D matrix and rearrange them into the blocks/windows of a 4D image volume. Notes ----- A NumPy reimagining of
numpy_ml/neural_nets/utils/utils.py:546
↓ 3 callersMethodfit
Fit the GP prior to the training data. Parameters ---------- X : :py:class:`ndarray <numpy.ndarray>` of shape `(N, M
numpy_ml/nonparametric/gp.py:44
↓ 3 callersMethodfit
Fit the regression model to the data and targets in `X` and `y`. Parameters ---------- X : :py:class:`ndarray <numpy
numpy_ml/nonparametric/kernel_regression.py:40
↓ 3 callersMethodfit
Compute the vocabulary across a collection of documents. Parameters ---------- corpus_fps : str or list of strs
numpy_ml/preprocessing/nlp.py:1166
↓ 3 callersMethodflush_gradients
Reset parameter gradients to 0 after an update.
numpy_ml/neural_nets/models/wgan_gp.py:424
↓ 3 callersMethodfn
r""" Compute the GELU function on the elements of input `z`. .. math:: \text{GELU}(z_i) = z_i P(Z \leq z_i) = z_i \Phi(z
numpy_ml/neural_nets/activations/activations.py:239
↓ 3 callersMethodforward
Compute the layer output on a single minibatch. Parameters ---------- X : :py:class:`ndarray <numpy.ndarray>` of sha
numpy_ml/neural_nets/layers/layers.py:2263
↓ 3 callersFunctiongeneralized_cosine
The generalized cosine family of window functions. Notes ----- The generalized cosine window is a simple weighted sum of cosine term
numpy_ml/utils/windows.py:108
↓ 3 callersMethodgrad
r""" Evaluate the first derivative of the GELU function on the elements of input `x`. .. math:: \frac{\partial \
numpy_ml/neural_nets/activations/activations.py:254
↓ 3 callersMethodgrad2
r""" Evaluate the second derivative of the ELU activation on the elements of input `x`. .. math:: \frac{\partial
numpy_ml/neural_nets/activations/activations.py:476
↓ 3 callersFunctionkernel_checks
(X, Y)
numpy_ml/utils/kernels.py:299
↓ 3 callersFunctionlog_gaussian_pdf
Compute log N(x_i | mu, sigma)
numpy_ml/utils/misc.py:16
↓ 3 callersMethodlog_likelihood
r""" Given the HMM parameterized by :math:`(A`, B, \pi)` and an observation sequence `O`, compute the marginal likelihood of `O`,
numpy_ml/hmm/hmm.py:122
↓ 3 callersMethodlog_prob
Compute the log probability of a sequence of words under the unsmoothed, maximum-likelihood `N`-gram language model. Paramet
numpy_ml/ngram/ngram.py:335
↓ 3 callersMethodlog_prob
r""" Compute the smoothed log probability of a sequence of words under the `N`-gram language model with Good-Turing smoothing.
numpy_ml/ngram/ngram.py:512
↓ 3 callersFunctionloss
(yp, y)
numpy_ml/plots/trees_plots.py:39
↓ 3 callersMethodloss
Compute the squared error between `y` and `y_pred`. Parameters ---------- y : :py:class:`ndarray <numpy.ndarray>` of
numpy_ml/neural_nets/losses/losses.py:49
next →1–100 of 1,202, ranked by callers