Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/ddbourgin/numpy-ml
/ functions
Functions
1,202 in github.com/ddbourgin/numpy-ml
⨍
Functions
1,202
◇
Types & classes
166
↓ 3 callers
Method
loss
Compute the cross-entropy (log) loss. Notes ----- This method returns the sum (not the average!) of the losses for e
numpy_ml/neural_nets/losses/losses.py:133
↓ 3 callers
Function
random_DAG
Create a 'random' unweighted directed acyclic graph by pruning all the backward connections from a random graph. Parameters --------
numpy_ml/utils/graphs.py:336
↓ 3 callers
Method
set_params
Set the layer parameters from a dictionary of values. Parameters ---------- summary_dict : dict A dictio
numpy_ml/neural_nets/layers/layers.py:4213
↓ 3 callers
Method
set_params
Set the model parameters and hyperparameters using the settings in `summary_dict`. Parameters ---------- sum
numpy_ml/utils/kernels.py:34
↓ 3 callers
Function
strip_punctuation
Remove punctuation from a string
numpy_ml/preprocessing/nlp.py:167
↓ 3 callers
Method
train
(self, corpus_fp, vocab=None, encoding=None)
numpy_ml/tests/test_ngram.py:30
↓ 2 callers
Function
DCT
A naive :math:`O(N^2)` implementation of the 1D discrete cosine transform-II (DCT-II). Notes ----- For a signal :math:`\mathbf{x
numpy_ml/preprocessing/dsp.py:161
↓ 2 callers
Function
DFT
A naive :math:`O(N^2)` implementation of the 1D discrete Fourier transform (DFT). Notes ----- The Fourier transform decomposes a sig
numpy_ml/preprocessing/dsp.py:224
↓ 2 callers
Function
LinearLayer
(name, n_in, n_out, inputs, w_initialization)
numpy_ml/tests/nn_torch_models.py:1859
↓ 2 callers
Method
__init__
A generic directed edge object. Parameters ---------- fr: int The id of the vertex the edge goes from
numpy_ml/utils/graphs.py:13
↓ 2 callers
Method
_build_tree
(self, X, y)
numpy_ml/utils/data_structures.py:259
↓ 2 callers
Method
_episode
Run the agent for an episode. Parameters ---------- W : :py:class:`ndarray <numpy.ndarray>` of shape `(obs_dim, n_ac
numpy_ml/rl_models/agents.py:278
↓ 2 callers
Method
_episode
Run or train the agent on an episode. Parameters ---------- max_steps : int The maximum number of steps
numpy_ml/rl_models/agents.py:992
↓ 2 callers
Method
_episode
Run or train the agent on an episode. Parameters ---------- max_steps : int The maximum number of steps
numpy_ml/rl_models/agents.py:1796
↓ 2 callers
Method
_forward
r""" Computes the forward probability trellis for an HMM parameterized by :math:`(A, B, \pi)`. Notes ----- Th
numpy_ml/hmm/hmm.py:291
↓ 2 callers
Method
_fwd
Actual computation of softmax forward pass
numpy_ml/neural_nets/layers/layers.py:2294
↓ 2 callers
Method
_get_params
(self)
numpy_ml/neural_nets/layers/layers.py:3910
↓ 2 callers
Function
_im2col_indices
Helper function that computes indices into X in prep for columnization in :func:`im2col`. Code extended from Andrej Karpathy's `im2col.p
numpy_ml/neural_nets/utils/utils.py:447
↓ 2 callers
Method
_init_params
(self)
numpy_ml/neural_nets/layers/layers.py:412
↓ 2 callers
Method
_log_ngram_prob
Return the unsmoothed log probability of the ngram
numpy_ml/ngram/ngram.py:308
↓ 2 callers
Method
_log_posterior
r""" Compute the (unnormalized) log posterior for each class. Parameters ---------- X: :py:class:`ndarray <numpy.ndar
numpy_ml/linear_models/naive_bayes.py:145
↓ 2 callers
Method
_map_estimate
Compute the current MAP estimate for an arm's payoff probability
numpy_ml/bandits/policies.py:386
↓ 2 callers
Method
_p_decreasing
Compute the probability that the slope of the OLS fit to the loss history is negative. Parameters ----------
numpy_ml/neural_nets/schedulers/schedulers.py:289
↓ 2 callers
Function
_sigmoid
The logistic sigmoid function
numpy_ml/linear_models/logistic.py:171
↓ 2 callers
Method
_split
(self, X, y=None)
numpy_ml/utils/data_structures.py:274
↓ 2 callers
Method
_steps_without_decrease
Returns the maximum number of timesteps for which `P(loss is decreasing) < 0.51`. Parameters ---------- robu
numpy_ml/neural_nets/schedulers/schedulers.py:246
↓ 2 callers
Method
_train
Actual N-gram training logic
numpy_ml/ngram/ngram.py:62
↓ 2 callers
Method
_update_factor
Perform the ALS update
numpy_ml/factorization/factors.py:95
↓ 2 callers
Method
_update_queue
Update the priority queue by calculating the priority for (s, a) and inserting it into the queue if it exceeds a fixed (small) thresh
numpy_ml/rl_models/agents.py:1620
↓ 2 callers
Method
act
r""" Execute the behavior policy--an :math:`\epsilon`-soft policy used to generate actions during training. Parameters
numpy_ml/rl_models/agents.py:1235
↓ 2 callers
Method
act
r""" Execute the behavior policy--an :math:`\epsilon`-soft policy used to generate actions during training. Parameters
numpy_ml/rl_models/agents.py:1480
↓ 2 callers
Method
all_paths
Find all simple paths between `s_i` and `e_i` in the graph. Notes ----- Uses breadth-first search. Ignores all paths
numpy_ml/utils/graphs.py:132
↓ 2 callers
Method
backward
Backprop from layer outputs to inputs. Parameters ---------- dLdy : :py:class:`ndarray <numpy.ndarray>` of shape `(n
numpy_ml/neural_nets/layers/layers.py:2300
↓ 2 callers
Method
cross_entropy
r""" Calculate the model cross-entropy on a sequence of words against the empirical distribution of words in a sample. Notes
numpy_ml/ngram/ngram.py:220
↓ 2 callers
Function
dft_bins
Calc the frequency bin centers for a DFT with `N` coefficients. Parameters ---------- N : int The number of frequency bins i
numpy_ml/preprocessing/dsp.py:276
↓ 2 callers
Function
dilate
Dilate the 4D volume `X` by `d`. Notes ----- For a visual depiction of a dilated convolution, see [1]. References ---------
numpy_ml/neural_nets/utils/utils.py:309
↓ 2 callers
Function
env_stats
Compute statistics for the current environment. Parameters ---------- env : ``gym.wrappers`` or ``gym.envs`` instance The en
numpy_ml/rl_models/rl_utils.py:430
↓ 2 callers
Method
extract_grads
(self, X, X_recon, t_mean, t_log_var)
numpy_ml/tests/nn_torch_models.py:55
↓ 2 callers
Method
extract_grads
(self, X, Y_true=None)
numpy_ml/tests/nn_torch_models.py:169
↓ 2 callers
Method
extract_grads
(self, X, Y_true=None)
numpy_ml/tests/nn_torch_models.py:248
↓ 2 callers
Method
fit
Compute the posterior over model parameters using the data in `X` and `y`. Parameters ---------- X : :py:cla
numpy_ml/linear_models/bayesian_regression.py:81
↓ 2 callers
Method
fit
Compute the posterior over model parameters using the data in `X` and `y`. Parameters ---------- X : :py:cla
numpy_ml/linear_models/bayesian_regression.py:237
↓ 2 callers
Method
fit
Create `n_trees`-worth of bootstrapped samples from the training data and use each to fit a separate decision tree.
numpy_ml/trees/rf.py:44
↓ 2 callers
Method
fit
Fit the gradient boosted decision trees on a dataset. Parameters ---------- X : :py:class:`ndarray <numpy.ndarray>`
numpy_ml/trees/gbdt.py:94
↓ 2 callers
Method
fit
Fit the parameters of the GMM on some training data. Parameters ---------- X : :py:class:`ndarray <numpy.ndarray>` o
numpy_ml/gmm/gmm.py:93
↓ 2 callers
Method
fn
r""" Evaulate the ReLU function on the elements of input `z`. .. math:: \text{ReLU}(z_i) &= z_i \ \ \ \
numpy_ml/neural_nets/activations/activations.py:104
↓ 2 callers
Method
fn
r""" Evaluate the softplus activation on the elements of input `z`. .. math:: \text{SoftPlus}(z_i) = \log(1 + e^{z_i})
numpy_ml/neural_nets/activations/activations.py:688
↓ 2 callers
Method
forward
Compute the layer output given input volume `X`. Parameters ---------- X : :py:class:`ndarray <numpy.ndarray>` of sh
numpy_ml/neural_nets/layers/layers.py:2714
↓ 2 callers
Method
freeze
Freeze the layer parameters at their current values so they can no longer be updated.
numpy_ml/neural_nets/layers/layers.py:4233
↓ 2 callers
Method
grad
r""" Evaluate the first derivative of the logistic sigmoid on the elements of `x`. .. math:: \frac{\partial \sigma}{\par
numpy_ml/neural_nets/activations/activations.py:49
↓ 2 callers
Method
grad
r""" Evaulate the first derivative of the ReLU function on the elements of input `x`. .. math:: \frac{\partial \text{ReL
numpy_ml/neural_nets/activations/activations.py:116
↓ 2 callers
Method
grad
r""" Evaluate the first derivative of the tanh function on the elements of input `x`. .. math:: \frac{\partial \
numpy_ml/neural_nets/activations/activations.py:317
↓ 2 callers
Method
grad
r""" Evaluate the first derivative of the ELU activation on the elements of input `x`. .. math:: \frac{\partial
numpy_ml/neural_nets/activations/activations.py:462
↓ 2 callers
Method
grad
r""" Evaluate the first derivative of the softplus activation on the elements of input `x`. .. math:: \frac{\par
numpy_ml/neural_nets/activations/activations.py:698
↓ 2 callers
Method
grad
Computes the gradient of the generator or critic loss with regard to its inputs. Parameters ---------- Y_fak
numpy_ml/neural_nets/losses/losses.py:457
↓ 2 callers
Method
grad
Compute the gradient of the NCE loss with regard to the inputs, weights, and biases. Parameters ---------- r
numpy_ml/neural_nets/losses/losses.py:818
↓ 2 callers
Method
greedy_policy
Take a greedy action. Returns ------- total_reward : float The total reward on the episode. n_st
numpy_ml/rl_models/agents.py:51
↓ 2 callers
Function
grow
(node_id)
numpy_ml/tests/test_trees.py:23
↓ 2 callers
Function
hashcoords
(coordinates, m, readonly=False)
numpy_ml/rl_models/tiles/tiles3.py:81
↓ 2 callers
Function
hz2mel
Convert the frequency representaiton of a signal in Hz into the mel scale. Parameters ---------- hz : :py:class:`ndarray <numpy.ndar
numpy_ml/preprocessing/dsp.py:745
↓ 2 callers
Method
init_logs
Initialize the episode logs. Notes ----- Training logs are represented as a nested set of dictionaries with the
numpy_ml/bandits/trainer.py:275
↓ 2 callers
Function
is_binary
Return True if array `x` consists only of binary values
numpy_ml/utils/testing.py:51
↓ 2 callers
Function
is_stochastic
True if `X` contains probabilities that sum to 1 along the columns
numpy_ml/utils/testing.py:30
↓ 2 callers
Function
is_symmetric_positive_definite
Check that a matrix `X` is a symmetric and positive-definite.
numpy_ml/utils/testing.py:16
↓ 2 callers
Function
mel_filterbank
Compute the filters in a Mel filterbank and return the corresponding transformation matrix Notes ----- The Mel scale is a percep
numpy_ml/preprocessing/dsp.py:772
↓ 2 callers
Function
minibatch
Compute the minibatch indices for a training dataset. Parameters ---------- X : :py:class:`ndarray <numpy.ndarray>` of shape `(N, \*
numpy_ml/neural_nets/utils/utils.py:8
↓ 2 callers
Method
nearest_neighbors
Find the `k` nearest neighbors in the ball tree to a query vector `x` using the KNS1 algorithm. Parameters ---------
numpy_ml/utils/data_structures.py:292
↓ 2 callers
Method
outcome_probs
Return the probability under the environment model of each outcome state after taking action `a` in state `s`. Parameters
numpy_ml/rl_models/rl_utils.py:76
↓ 2 callers
Method
predict
Use the trained model to generate prediction probabilities on a new collection of data points. Parameters ----------
numpy_ml/linear_models/logistic.py:150
↓ 2 callers
Method
predict
Use the trained model to generate predictions on a new collection of data points. Parameters ---------- X :
numpy_ml/linear_models/ridge.py:86
↓ 2 callers
Method
predict
Return the log probability of each data point in `X` under each mixture components. Parameters ---------- X
numpy_ml/gmm/gmm.py:145
↓ 2 callers
Method
push
Add a new (key, value) pair with priority `priority` to the queue. Notes ----- If the queue is at capacity and `prio
numpy_ml/utils/data_structures.py:96
↓ 2 callers
Function
random_bernoulli_mab
Generate a random Bernoulli multi-armed bandit environemt
numpy_ml/plots/bandit_plots.py:39
↓ 2 callers
Function
random_multinomial_mab
Generate a random multinomial multi-armed bandit environemt
numpy_ml/plots/bandit_plots.py:23
↓ 2 callers
Function
random_regression_problem
(n_ex, n_in, n_out, intercept=0, std=1, seed=0)
numpy_ml/plots/lm_plots.py:38
↓ 2 callers
Function
random_regression_problem
(n_ex, n_in, n_out, d=3, intercept=0, std=1, seed=0)
numpy_ml/plots/nonparametric_plots.py:18
↓ 2 callers
Function
remove_stop_words
Remove stop words from a list of word strings
numpy_ml/preprocessing/nlp.py:162
↓ 2 callers
Method
reverse
Reverse the edge direction
numpy_ml/utils/graphs.py:40
↓ 2 callers
Method
reward_outcome_pairs
Return all (reward, next_state) pairs associated with taking action `a` in state `s`.
numpy_ml/rl_models/rl_utils.py:69
↓ 2 callers
Method
sample
Generate random draws from the `probs` distribution over integers in [0, N). Parameters ---------- n_samples
numpy_ml/utils/data_structures.py:441
↓ 2 callers
Method
state_action_pairs
Return all (state, action) pairs in the environment model
numpy_ml/rl_models/rl_utils.py:65
↓ 2 callers
Function
test
(mine, clone)
numpy_ml/tests/test_trees.py:43
↓ 2 callers
Function
tile_state_space
Return a function to encode the continous observations generated by `env` in terms of a collection of `n_tilings` overlapping tilings (each w
numpy_ml/rl_models/rl_utils.py:124
↓ 2 callers
Method
to_dict
Return a dictionary representation of the node's contents
numpy_ml/utils/data_structures.py:26
↓ 2 callers
Function
to_frames
Convert a 1D signal x into overlapping windows of width `frame_width` using a hop length of `stride`. Notes ----- If ``(len(x) -
numpy_ml/preprocessing/dsp.py:354
↓ 2 callers
Method
topological_ordering
Returns a (non-unique) topological sort / linearization of the nodes IFF the graph is acyclic, otherwise returns None. Notes
numpy_ml/utils/graphs.py:200
↓ 2 callers
Method
train
Compile the n-gram counts for the text(s) in `corpus_fp`. Upon completion the `self.counts` attribute will store dictionaries of the
numpy_ml/ngram/ngram.py:490
↓ 2 callers
Method
transform
Standardize features by removing the mean and scaling to unit variance. For a sample `x`, the standardized score is calculated as:
numpy_ml/preprocessing/general.py:216
↓ 2 callers
Function
truncated_normal
Generate draws from a truncated normal distribution via rejection sampling. Notes ----- The rejection sampling regimen draws samples
numpy_ml/neural_nets/utils/utils.py:998
↓ 2 callers
Method
unfreeze
Unfreeze the layer parameters so they can be updated.
numpy_ml/neural_nets/layers/layers.py:4240
↓ 2 callers
Method
update
Perform gradient updates
numpy_ml/neural_nets/models/vae.py:387
↓ 2 callers
Method
update
Perform gradient updates
numpy_ml/neural_nets/models/w2v.py:242
↓ 2 callers
Method
update
r""" Incrementally update the linear least-squares coefficients for a set of new examples. Notes ----- The re
numpy_ml/linear_models/linear_regression.py:62
↓ 1 callers
Function
Generator
(n_samples, X_real, params=None)
numpy_ml/tests/nn_torch_models.py:1871
↓ 1 callers
Function
TFNCELoss
(X, target_word, L)
numpy_ml/tests/nn_torch_models.py:2192
↓ 1 callers
Method
VLB
Return the variational lower bound associated with the current model parameters.
numpy_ml/lda/lda.py:151
↓ 1 callers
Function
WGAN_GP_tf
(X, lambda_, params, batch_size)
numpy_ml/tests/nn_torch_models.py:1944
↓ 1 callers
Method
_E_step
r""" Run a single E-step update for the Baum-Welch/Forward-Backward algorithm. This step estimates ``xi`` and ``gamma``, the excepted
numpy_ml/hmm/hmm.py:537
↓ 1 callers
Method
_E_step
Maximize the VLB with respect to the variational parameters, γ and ϕ
numpy_ml/lda/lda.py:137
↓ 1 callers
Method
_E_step
(self, X)
numpy_ml/gmm/gmm.py:185
← previous
next →
101–200 of 1,202, ranked by callers