scedar.eda package¶
Submodules¶
scedar.eda.mdl module¶
-
class
scedar.eda.mdl.
GKdeMdl
(x, kde_bw_method='scott', dtype=dtype('float64'), copy=True)[source]¶ Bases:
scedar.eda.mdl.Mdl
Use Gaussian kernel density estimation to compute mdl
Parameters: - x (1D np.number array) – data used for fit mdl
- bandwidth_method – string KDE bandwidth estimation method bing passed to scipy.stats.gaussian_kde. Types: * “scott”: Scott’s rule of thumb. * “silverman”: Silverman”s rule of thumb. * constant: constant will be timed by x.std(ddof=1) internally, because scipy times bw_method value by std. “Scipy weights its bandwidth by the ovariance of the input data” [3]. * callable: scipy calls the function on self
- dtype (np.dtype) – default to 64-bit float
- copy (bool) – passed to np.array()
-
_x
¶ 1d float array – data to fit
-
_n
¶ int – number of elements in data
-
_bw_method
¶ str – bandwidth method
-
_kde
¶ scipy kde
-
_logdens
¶ 1d float array – log density
-
bandwidth
¶
-
encode
(qx, mdl_scale_factor=1)[source]¶ Encode query data using fitted KDE code
Parameters: - qx (1d float array) –
- mdl_scale_factor (number) – times mdl by this number
Returns: mdl
Return type: float
-
static
gaussian_kde_logdens
(bandwidth_method='scott', ret_kernel=False)[source]¶ Estimate Gaussian kernel density estimation bandwidth for input x.
Parameters: - x (float array of shape (n_samples) or (n_samples, n_features)) – Data points for KDE estimation.
- bandwidth_method (string) – KDE bandwidth estimation method bing passed to scipy.stats.gaussian_kde.
-
kde
¶
-
mdl
¶
-
class
scedar.eda.mdl.
Mdl
(x, dtype=dtype('float64'), copy=True)[source]¶ Bases:
abc.ABC
Minimum description length abstract base class
- Interface of various mdl schemas. Subclasses must implement mdl property
- and encode method.
-
_x
¶ 1D np.number array – data used for fit mdl
-
_n
¶ np.int – number of points in x
-
encode
(x)[source]¶ Encode another 1D number array with fitted code :param x: data to encode :type x: 1D np.number array
-
mdl
¶
-
x
¶
-
class
scedar.eda.mdl.
MultinomialMdl
(x, dtype=dtype('float64'), copy=True)[source]¶ Bases:
scedar.eda.mdl.Mdl
Encode discrete values using multinomial distribution
Parameters: - x (1D np.number array) – data used for fit mdl
- dtype (np.dtype) – default to 64-bit float
- copy (bool) – passed to np.array()
Note
When x only has 1 uniq value. Encode the the number of values only.
-
encode
(qx, use_adjescent_when_absent=False)[source]¶ Encode another 1D float array with fitted code
Parameters: - qx (1d float array) – query data
- use_adjescent_when_absent (bool) – whether to use adjascent value to compute query mdl. If not, uniform mdl is used. If adjascent values have same distance to query value, choose the one with smaller mdl.
Returns: qmdl (float)
-
mdl
¶
-
class
scedar.eda.mdl.
ZeroIGKdeMdl
(x, kde_bw_method='scott', dtype=dtype('float64'), copy=True)[source]¶ Bases:
scedar.eda.mdl.Mdl
Zero indicator Gaussian KDE MDL
Encode the 0s and non-0s using bernoulli distribution. Then, encode non-0s using gaussian kde. Finally, one ternary val indicates all 0s, all non-0s, or otherwise
Parameters: - x (1D np.number array) – data used for fit mdl
- bandwidth_method – string KDE bandwidth estimation method bing passed to scipy.stats.gaussian_kde. Types: * “scott”: Scott’s rule of thumb. * “silverman”: Silverman”s rule of thumb. * constant: constant will be timed by x.std(ddof=1) internally, because scipy times bw_method value by std. “Scipy weights its bandwidth by the ovariance of the input data” [3]. * callable: scipy calls the function on self
- dtype (np.dtype) – default to 64-bit float
- copy (bool) – passed to np.array()
References
[1] https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.gaussian_kde.html
[2] https://en.wikipedia.org/wiki/Kernel_density_estimation
[3] https://jakevdp.github.io/blog/2013/12/01/kernel-density-estimation/
[4] https://github.com/scipy/scipy/blob/v1.0.0/scipy/stats/kde.py#L42-L564
-
bandwidth
¶
-
kde
¶
-
kde_mdl
¶
-
mdl
¶
-
x_nonzero
¶
-
zi_mdl
¶
-
class
scedar.eda.mdl.
ZeroIMdl
(x, dtype=dtype('float64'), copy=True)[source]¶ Bases:
scedar.eda.mdl.Mdl
Encode an indicator vector of 0s and non-0s
-
encode
(qx)[source]¶ Encode another 1D number array with fitted code :param x: data to encode :type x: 1D np.number array
-
mdl
¶
-
-
class
scedar.eda.mdl.
ZeroIMultinomialMdl
(x, dtype=dtype('float64'), copy=True)[source]¶ Bases:
scedar.eda.mdl.Mdl
-
encode
(qx, use_adjescent_when_absent=False)[source]¶ Encode another 1D number array with fitted code :param x: data to encode :type x: 1D np.number array
-
mdl
¶
-
-
scedar.eda.mdl.
np_number_1d
(x, dtype=dtype('float64'), copy=True)[source]¶ Convert x to 1d np number array
Parameters: - x (1d sequence of values convertable to np.number) –
- dtype (np number type) – default to 64-bit float
- copy (bool) – passed to np.array()
Returns: xarr (1d np.number array)
Raises: ValueError
– If x is not convertable to provided dtype or non-1d. If dtype is not subdtype of np number.
scedar.eda.mtype module¶
-
scedar.eda.mtype.
is_uniq_np1darr
(x)[source]¶ Test whether x is a 1D np array that only contains unique values.
scedar.eda.plot module¶
-
scedar.eda.plot.
cluster_scatter
(projection2d, labels=None, selected_labels=None, plot_different_markers=False, label_markers=None, shuffle_label_colors=False, gradient=None, xlim=None, ylim=None, title=None, xlab=None, ylab=None, figsize=(20, 20), add_legend=True, n_txt_per_cluster=3, alpha=1, s=0.5, random_state=None, **kwargs)[source]¶ Scatter plot for clustering illustration
Parameters: - projection2d (2 col numeric array) – (n, 2) matrix to plot
- labels (list of labels) – labels of n samples
- selected_labels (list of labels) – selected labels to plot
- plot_different_markers (bool) – plot different markers for samples with different labels
- label_markers (list of marker shapes) – passed to matplotlib plot
- shuffle_label_colors (bool) – shuffle the color of labels to avoid similar colors show up in close clusters
- gradient (list of number) – color gradient of n samples
- title (str) –
- xlab (str) – x axis label
- ylab (str) – y axis label
- figsize (tuple of two number) – (width, height)
- add_legend (bool) –
- n_txt_per_cluster (number) – the number of text to plot per cluster. Could be 0.
- alpha (number) –
- s (number) – size of the points
- random_state (int) – random seed to shuffle features
- **kwards – passed to matplotlib plot
Returns: matplotlib figure of the created scatter plot
-
scedar.eda.plot.
heatmap
(x, row_labels=None, col_labels=None, title=None, xlab=None, ylab=None, figsize=(20, 20), transform=None, **kwargs)[source]¶
-
scedar.eda.plot.
hist_dens_plot
(x, title=None, xlab=None, ylab=None, figsize=(5, 5), ax=None, **kwargs)[source]¶ Plot histogram and density plot of x.
-
scedar.eda.plot.
networkx_graph
(ng, pos=None, alpha=0.05, figsize=(20, 20), gradient=None, labels=None, different_label_markers=True, node_size=30, node_with_labels=False, nx_draw_kwargs=None)[source]¶
scedar.eda.sdm module¶
-
class
scedar.eda.sdm.
HClustTree
(node, prev=None)[source]¶ Bases:
object
Hierarchical clustering tree.
Implement simple tree operation routines. HCT is binary unbalanced tree.
-
node
¶ scipy.cluster.hierarchy.ClusterNode – current node
-
prev
¶ HClustTree – parent of current node
-
bi_partition
(soft_min_subtree_size=1, return_subtrees=False)[source]¶ soft_min_subtree_size: when curr tree size < 2 * soft_min_subtree_size, it is impossible to have a bipartition with a minimum sub tree size bigger than soft_min_subtree_size. In this case, return the first partition.
When soft_min_subtree_size = 1, the performance is the same as taking the first bipartition.
When curr size = 1, the first bipartition gives (1, 0). Because curr size < 2 * soft_min_subtree_size, it goes directly to return.
When curr size = 2, the first bipartition guarantees to give (1, 1), with the invariant that parent nodes of leaves always have 2 child nodes. This also goes directly to return.
When curr size >= 3, the first bipartition guarantees to give two subtrees with size >= 1, with the same invariant in size = 2.
-
static
cluster_id_to_lab_list
(sid_list)[source]¶ Convert nested clustered ID list into cluster label list.
For example, convert [[0, 1, 2], [3,4]] to [0, 0, 0, 1, 1] according to id_arr [0, 1, 2, 3, 4]
Parameters
- cl_sid_list: list[list[id]]
- Nested list with each sublist as a sert of IDs from a cluster.
- sid_list: list[id]
- Flat list of lists.
-
static
hclust_tree
(linkage='complete', n_eval_rounds=None, is_euc_dist=False, optimal_ordering=False, verbose=False)[source]¶
-
prev
-
-
class
scedar.eda.sdm.
SampleDistanceMatrix
(x, d=None, metric='correlation', sids=None, fids=None, nprocs=None)[source]¶ Bases:
scedar.eda.sfm.SampleFeatureMatrix
SampleDistanceMatrix: data with pairwise distance matrix
Parameters: - x (ndarray or list) – data matrix (n_samples, n_features)
- d (ndarray or list or None) – distance matrix (n_samples, n_samples) If is None, d will be computed with x, metric, and nprocs.
- metric (string) – distance metric
- sids (homogenous list of int or string) – sample ids. Should not contain duplicated elements.
- fids (homogenous list of int or string) – feature ids. Should not contain duplicated elements.
- nprocs (int) – the number of processes for computing pairwise distance matrix
-
_x
¶ ndarray – data matrix (n_samples, n_features)
-
_d
¶ ndarray – distance matrix (n_samples, n_samples)
-
_metric
¶ string – distance metric
-
_sids
¶ ndarray – sample ids.
-
_fids
¶ ndarray – sample ids.
-
_tsne_lut
¶ dict – lookup table for previous tsne calculations. Each run has an indexed entry, {(param_str, index) : tsne_res}
-
_last_tsne
¶ float array – The last stored tsne results. In no tsne performed before, a run with default parameters will be performed.
-
_knn_ng_lut
¶ dict – {(k, aff_scale): knn_graph}
-
static
correlation_pdist
()[source]¶ Compute pairwise correlation pdist for x (n_samples, n_features).
Adapted from Waylon Flinn’s post on https://stackoverflow.com/a/20687984/4638182 .
Parameters: x (ndarray) – (n_samples, n_features) Returns: d – Pairwise distance matrix, (n_samples, n_samples). Return type: ndarray
-
static
cosine_pdist
()[source]¶ Compute pairwise cosine pdist for x (n_samples, n_features).
Adapted from Waylon Flinn’s post on https://stackoverflow.com/a/20687984/4638182 .
Cosine distance is undefined if one of the vectors contain only 0s.
Parameters: x (ndarray) – (n_samples, n_features) Returns: d – Pairwise distance matrix, (n_samples, n_samples). Return type: ndarray
-
d
¶
-
get_tsne_kv
(key)[source]¶ Get t-SNE results from the lookup table. Return None if non-existent.
Returns: res_tuple – (key, val) pair of tsne result. Return type: tuple
-
id_x
(selected_sids=None, selected_fids=None)[source]¶ Subset samples by (sample IDs, feature IDs).
Parameters: - selected_s_inds (int array) – Index array of selected samples. If is None, select all.
- selected_f_inds (int array) – Index array of selected features. If is None, select all.
Returns: subset
Return type:
-
ind_x
(selected_s_inds=None, selected_f_inds=None)[source]¶ Subset samples by (sample IDs, feature IDs).
Parameters: - selected_s_inds (int array) – Index array of selected samples. If is None, select all.
- selected_f_inds (int array) – Index array of selected features. If is None, select all.
Returns: subset
Return type:
-
metric
¶
-
par_tsne
(param_list, store_res=True, nprocs=1)[source]¶ Run t-SNE with multiple sets of parameters parallely.
Parameters: - param_list (list of dict) – List of parameters being passed to t-SNE.
- nprocs (int) – Number of processes.
Returns: tsne_res_list – List of t-SNE results of corresponding parameter set.
Return type: list of float arrays
Notes
Parallel running results cannot be stored during the run, because racing conditions may happen.
-
pca_feature_gradient_plot
(fid, component_ind_pair=(0, 1), transform=None, labels=None, selected_labels=None, plot_different_markers=False, label_markers=None, shuffle_label_colors=False, xlim=None, ylim=None, title=None, xlab=None, ylab=None, figsize=(20, 20), add_legend=True, n_txt_per_cluster=3, alpha=1, s=0.5, random_state=None, **kwargs)[source]¶ Plot the last PCA projection with the provided gradient as color.
Parameters: - component_ind_pair (tuple of two ints) – Indices of the components to plot.
- fid (feature id scalar) – ID of the feature to be used for gradient plot.
- transform (callable) – Map transform on feature before plotting.
- labels (label array) – Labels assigned to each point, (n_samples,).
- selected_labels (label array) – Show gradient only for selected labels. Do not show non-selected.
-
pca_plot
(component_ind_pair=(0, 1), gradient=None, labels=None, selected_labels=None, plot_different_markers=False, label_markers=None, shuffle_label_colors=False, xlim=None, ylim=None, title=None, xlab=None, ylab=None, figsize=(20, 20), add_legend=True, n_txt_per_cluster=3, alpha=1, s=0.5, random_state=None, **kwargs)[source]¶ Plot the PCA projection with the provided gradient as color. Gradient is None by default.
-
s_ith_nn_d_dist
(i, xlab=None, ylab=None, title=None, figsize=(5, 5), ax=None, **kwargs)[source]¶ Plot the distances of the i-th nearest neighbor of all samples.
-
s_knn_connectivity_matrix
(k)[source]¶ Computes the connectivity matrix of KNN of samples. If an entry (i, j) has value 0, node i is not in node j’s KNN. If an entry (i, j) has value > 0, node i is in j’s KNN, and their distance is the entry value.
Parameters: k (int) – Returns: knn_conn_mat – (n_samples, n_samles) Return type: float array
-
s_knn_graph
(k, gradient=None, labels=None, different_label_markers=True, aff_scale=1, iterations=2000, figsize=(20, 20), node_size=30, alpha=0.05, random_state=None, init_pos=None, node_with_labels=False, fa2_kwargs=None, nx_draw_kwargs=None)[source]¶ Draw KNN graph of SampleDistanceMatrix. Graph layout using forceatlas2 for its speed on large graph.
Parameters: - k (int) –
- gradient (float array) – (n_samples,) color gradient
- labels (label list) – (n_samples,) labels
- different_label_markers (bool) – whether plot different labels with different markers
- aff_scale (float) – Affinity is calculated by (max(distance) - distance) * aff_scale
- iterations (int) – ForceAtlas2 iterations
- figsize ((float, float)) –
- node_size (float) –
- alpha (float) –
- random_state (int) –
- init_pos (float array) – Initial position of ForceAtlas2, (n_samples, 2).
- node_with_labels (bool) –
- fa2_kwargs (dict) –
- nx_draw_kwargs (dict) –
Returns: fig – KNN graph.
Return type: matplotlib figure
-
s_knn_ind_lut
(k)[source]¶ Computes the lookup table for sample i and its KNN indices, i.e. {i : [1st_NN_ind, 2nd_NN_ind, …, nth_NN_ind], …}
-
to_classified
(labels)[source]¶ Convert to SingleLabelClassifiedSamples
Parameters: labels (list of labels) – sample labels. Returns: SingleLabelClassifiedSamples
-
tsne
(store_res=True, **kwargs)[source]¶ Run t-SNE on distance matrix.
Parameters: - store_res (bool) – Store the results in lookup table or not.
- **kwargs – Keyword arguments passed to tsne computation.
Returns: tsne_res – t-SNE projections, (n_samples, m dimensions).
Return type: float array
-
tsne_feature_gradient_plot
(fid, transform=None, labels=None, selected_labels=None, plot_different_markers=False, label_markers=None, shuffle_label_colors=False, xlim=None, ylim=None, title=None, xlab=None, ylab=None, figsize=(20, 20), add_legend=True, n_txt_per_cluster=3, alpha=1, s=0.5, random_state=None, **kwargs)[source]¶ Plot the last t-SNE projection with the provided gradient as color.
Parameters: - fid (feature id scalar) – ID of the feature to be used for gradient plot.
- transform (callable) – Map transform on feature before plotting.
- labels (label array) – Labels assigned to each point, (n_samples,).
- selected_labels (label array) – Show gradient only for selected labels. Do not show non-selected.
-
tsne_lut
¶
-
tsne_plot
(gradient=None, labels=None, selected_labels=None, plot_different_markers=False, label_markers=None, shuffle_label_colors=False, xlim=None, ylim=None, title=None, xlab=None, ylab=None, figsize=(20, 20), add_legend=True, n_txt_per_cluster=3, alpha=1, s=0.5, random_state=None, **kwargs)[source]¶ Plot the last t-SNE projection with the provided gradient as color. Gradient is None by default.
-
umap
(n_neighbors=5, n_components=2, n_epochs=None, learning_rate=1.0, init='spectral', min_dist=0.1, spread=1.0, set_op_mix_ratio=1.0, local_connectivity=1.0, repulsion_strength=1.0, negative_sample_rate=5, transform_queue_size=4.0, a=None, b=None, random_state=None, metric_kwds=None, angular_rp_forest=False, target_n_neighbors=-1, target_metric='categorical', target_metric_kwds=None, target_weight=0.5, transform_seed=42, verbose=False)[source]¶
-
umap_feature_gradient_plot
(fid, component_ind_pair=(0, 1), transform=None, labels=None, selected_labels=None, plot_different_markers=False, label_markers=None, shuffle_label_colors=False, xlim=None, ylim=None, title=None, xlab=None, ylab=None, figsize=(20, 20), add_legend=True, n_txt_per_cluster=3, alpha=1, s=0.5, random_state=None, **kwargs)[source]¶ Plot the last UMAP projection with the provided gradient as color.
Parameters: - component_ind_pair (tuple of two ints) – Indices of the components to plot.
- fid (feature id scalar) – ID of the feature to be used for gradient plot.
- transform (callable) – Map transform on feature before plotting.
- labels (label array) – Labels assigned to each point, (n_samples,).
- selected_labels (label array) – Show gradient only for selected labels. Do not show non-selected.
-
umap_plot
(component_ind_pair=(0, 1), gradient=None, labels=None, selected_labels=None, plot_different_markers=False, label_markers=None, shuffle_label_colors=False, xlim=None, ylim=None, title=None, xlab=None, ylab=None, figsize=(20, 20), add_legend=True, n_txt_per_cluster=3, alpha=1, s=0.5, random_state=None, **kwargs)[source]¶ Plot the UMAP projection with the provided gradient as color. Gradient is None by default.
TODO: refactor plotting interface. Merge multiple plotting methods into one.
scedar.eda.sfm module¶
-
class
scedar.eda.sfm.
SampleFeatureMatrix
(x, sids=None, fids=None)[source]¶ Bases:
object
SampleFeatureMatrix is a (n_samples, n_features) matrix.
In this package, we are only interested in float features as measured expression levels.
Parameters: - x (ndarray or list) – data matrix (n_samples, n_features)
- sids (homogenous list of int or string) – sample ids. Should not contain duplicated elements.
- fids (homogenous list of int or string) – feature ids. Should not contain duplicated elements.
-
_x
¶ ndarray – data matrix (n_samples, n_features)
-
_sids
¶ ndarray – sample ids.
-
_fids
¶ ndarray – sample ids.
-
f_cv
(f_cv_filter=None)[source]¶ For each sample, compute the coefficient of variation of all features.
Returns: xf – (filtered_n_samples,) Return type: float array
-
f_cv_dist
(f_cv_filter=None, xlab=None, ylab=None, title=None, figsize=(5, 5), ax=None, **kwargs)[source]¶ Plot the distribution of the feature sum of each sample, (n_samples,).
-
f_gc
(f_gc_filter=None)[source]¶ For each sample, compute the Gini coefficients of all features.
Returns: xf – (filtered_n_samples,) Return type: float array
-
f_gc_dist
(f_gc_filter=None, xlab=None, ylab=None, title=None, figsize=(5, 5), ax=None, **kwargs)[source]¶ Plot the distribution of the feature Gini coefficient of each sample, (n_samples,).
-
f_id_dist
(f_id, sample_filter=None, xlab=None, ylab=None, title=None, figsize=(5, 5), ax=None, **kwargs)[source]¶
-
f_id_regression_scatter
(xf_id, yf_id, sample_filter=None, xlab=None, ylab=None, title=None, **kwargs)[source]¶ Regression plot on two features with xf_id and yf_id.
Parameters: - xf_id (int) – Sample ID of x.
- yf_ind (int) – Sample ID of y.
- sample_filter (bool array, or int array, or callable(x, y)) – If sample_filter is bool / int array, directly select features with it. If sample_filter is callable, it will be applied on each (x, y) value tuple.
- xlab (str) –
- ylab (str) –
- title (str) –
-
f_ind_dist
(f_ind, sample_filter=None, xlab=None, ylab=None, title=None, figsize=(5, 5), ax=None, **kwargs)[source]¶
-
f_ind_regression_scatter
(xf_ind, yf_ind, sample_filter=None, xlab=None, ylab=None, title=None, **kwargs)[source]¶ Regression plot on two features with xf_ind and yf_ind.
Parameters: - xf_ind (int) – Sample index of x.
- yf_ind (int) – Sample index of y.
- sample_filter (bool array, or int array, or callable(x, y)) – If sample_filter is bool / int array, directly select features with it. If sample_filter is callable, it will be applied on each (x, y) value tuple.
- xlab (str) –
- ylab (str) –
- title (str) –
-
f_n_above_threshold
(closed_threshold)[source]¶ For each sample, compute the number of features above a closed threshold.
-
f_n_above_threshold_dist
(closed_threshold, xlab=None, ylab=None, title=None, figsize=(5, 5), ax=None, **kwargs)[source]¶ Plot the distribution of the the number of above threshold samples of each feature, (n_features,).
-
f_sum
(f_sum_filter=None)[source]¶ For each sample, compute the sum of all features.
Returns: rowsum – (filtered_n_samples,) Return type: float array
-
f_sum_dist
(f_sum_filter=None, xlab=None, ylab=None, title=None, figsize=(5, 5), ax=None, **kwargs)[source]¶ Plot the distribution of the feature sum of each sample, (n_samples,).
-
fids
¶
-
id_x
(selected_sids=None, selected_fids=None)[source]¶ Subset samples by (sample IDs, feature IDs).
Parameters: - selected_sids (id array) – ID array of selected samples. If is None, select all.
- selected_fids (id array) – ID array of selected features. If is None, select all.
Returns: subset
Return type:
-
ind_x
(selected_s_inds=None, selected_f_inds=None)[source]¶ Subset samples by (sample IDs, feature IDs).
Parameters: - selected_s_inds (int array) – Index array of selected samples. If is None, select all.
- selected_f_inds (int array) – Index array of selected features. If is None, select all.
Returns: subset
Return type:
-
s_cv
(s_cv_filter=None)[source]¶ For each feature, compute the coefficient of variation of all samples.
Returns: xf – (n_features,) Return type: float array
-
s_cv_dist
(s_cv_filter=None, xlab=None, ylab=None, title=None, figsize=(5, 5), ax=None, **kwargs)[source]¶ Plot the distribution of the sample coefficient of variation of each feature, (n_features,).
-
s_gc
(s_gc_filter=None)[source]¶ For each feature, compute the Gini coefficient of all samples.
Returns: xf – (n_features,) Return type: float array
-
s_gc_dist
(s_gc_filter=None, xlab=None, ylab=None, title=None, figsize=(5, 5), ax=None, **kwargs)[source]¶ Plot the distribution of the sample Gini coefficients of each feature, (n_features,).
-
s_id_dist
(s_id, feature_filter=None, xlab=None, ylab=None, title=None, figsize=(5, 5), ax=None, **kwargs)[source]¶
-
s_id_regression_scatter
(xs_id, ys_id, feature_filter=None, xlab=None, ylab=None, title=None, **kwargs)[source]¶ Regression plot on two samples with xs_id and ys_id.
Parameters: - xs_ind (int) – Sample ID of x.
- ys_ind (int) – Sample ID of y.
- feature_filter (bool array, or int array, or callable(x, y)) – If feature_filter is bool / int array, directly select features with it. If feature_filter is callable, it will be applied on each (x, y) value tuple.
- xlab (str) –
- ylab (str) –
- title (str) –
-
s_ind_dist
(s_ind, feature_filter=None, xlab=None, ylab=None, title=None, figsize=(5, 5), ax=None, **kwargs)[source]¶
-
s_ind_regression_scatter
(xs_ind, ys_ind, feature_filter=None, xlab=None, ylab=None, title=None, **kwargs)[source]¶ Regression plot on two samples with xs_ind and ys_ind.
Parameters: - xs_ind (int) – Sample index of x.
- ys_ind (int) – Sample index of y.
- feature_filter (bool array, or int array, or callable(x, y)) – If feature_filter is bool / int array, directly select features with it. If feature_filter is callable, it will be applied on each (x, y) value tuple.
- xlab (str) –
- ylab (str) –
- title (str) –
-
s_n_above_threshold
(closed_threshold)[source]¶ For each feature, compute the number of samples above a closed threshold.
-
s_n_above_threshold_dist
(closed_threshold, xlab=None, ylab=None, title=None, figsize=(5, 5), ax=None, **kwargs)[source]¶ Plot the distribution of the the number of above threshold samples of each feature, (n_features,).
-
s_sum
(s_sum_filter=None)[source]¶ For each feature, computer the sum of all samples.
Returns: xf – (filtered_n_features,) Return type: float array
-
s_sum_dist
(s_sum_filter=None, xlab=None, ylab=None, title=None, figsize=(5, 5), ax=None, **kwargs)[source]¶ Plot the distribution of the sample sum of each feature, (n_features,).
-
sids
¶
-
x
¶
scedar.eda.slcs module¶
-
class
scedar.eda.slcs.
MDLSingleLabelClassifiedSamples
(x, labs, sids=None, fids=None, encode_type='data', mdl_method=<class 'scedar.eda.mdl.ZeroIGKdeMdl'>, d=None, metric='correlation', nprocs=None)[source]¶ Bases:
scedar.eda.slcs.SingleLabelClassifiedSamples
MDLSingleLabelClassifiedSamples inherits SingleLabelClassifiedSamples to offer MDL operations.
Parameters: - x (2d number array) – data matrix
- labs (list of str or int) – labels
- sids (list of str or int) – sample ids
- fids (list of str or int) – feature ids
- encode_type ("auto", "data", or "distance") – Type of values to encode. If “auto”, encode data when n_features <= 100.
- mdl_method (mdl.Mdl) – If None, use ZeroIGKdeMdl for encoded values with >= 50% zeros, and use GKdeMdl otherwise.
- d (2d number array) – distance matrix
- metric (str) – distance metric for scipy
- nprocs (int) –
-
_mdl_method
¶ .mdl.Mdl
-
class
LabMdlResult
(ulab_mdl_sum, ulab_s_inds, ulab_cnts, ulab_mdls, cluster_mdl)¶ Bases:
tuple
-
cluster_mdl
¶ Alias for field number 4
-
ulab_cnts
¶ Alias for field number 2
-
ulab_mdl_sum
¶ Alias for field number 0
-
ulab_mdls
¶ Alias for field number 3
-
ulab_s_inds
¶ Alias for field number 1
-
-
static
compute_cluster_mdl
(cl_mdl_scale_factor=1)[source]¶ Additional MDL for encoding the cluster
- labels are encoded by multinomial distribution
- parameters are encoded by 32bit float np.log(2**32) = 22.18070977791825
- scaled by factor
TODO: formalize parameter mdl
-
encode
(qx, col_summary_func=<built-in function sum>, non_zero_only=False, nprocs=1, verbose=False)[source]¶ Encode input array qx with fitted code without label
Parameters: - qx (2d np number array) –
- col_summary_func (callable) – function applied on column mdls
- non_zero_only (bool) – whether to encode non-zero entries only
- nprocs (int) –
- verbose (bool) –
Returns: mdl for encoding qx
Return type: float
-
lab_mdl
(cl_mdl_scale_factor=1, nprocs=1, verbose=False, ret_internal=False)[source]¶ Compute mdl of each feature after separating samples by labels
Parameters: - cl_mdl_scale_factor (float) – multiplies cluster related mdl by this number
- nprocs (int) –
- verbose (bool) – Not implemented
Returns: mdl of matrix after separating sampels by labels
Return type: float
-
no_lab_mdl
(nprocs=1, verbose=False)[source]¶ Compute mdl of each feature without separating samples by labels
Parameters: - nprocs (int) –
- verbose (bool) – Not implemented
Returns: mdl of matrix without separating samples by labels
Return type: float
-
static
per_col_encoders
(encode_type, mdl_method=<class 'scedar.eda.mdl.ZeroIGKdeMdl'>, nprocs=1, verbose=False)[source]¶ Compute mdl encoder for each column
Parameters: - x (2d number array) –
- encode_type ("data" or "distance") –
- mdl_method (mdl.Mdl) –
- nprocs (int) –
- verbose (bool) –
Returns: obj: list of column mdl encoders of x
-
class
scedar.eda.slcs.
SingleLabelClassifiedSamples
(x, labs, sids=None, fids=None, d=None, metric='correlation', nprocs=None)[source]¶ Bases:
scedar.eda.sdm.SampleDistanceMatrix
Data structure of single label classified samples
-
_x
¶ 2D number array – (n_samples, n_features) data matrix.
-
_d
¶ 2D number array – (n_samples, n_samples) distance matrix.
-
_labs
¶ list of labels – list of labels in the same type, int or str.
-
_fids
¶ list of feature IDs – list of feature IDs in the same type, int or str.
-
_sids
¶ list of sample IDs – list of sample IDs in the same type, int or str.
-
_metric
¶ str – Distance metric.
Note
If sort by labels, the samples will be reordered, so that samples from left to right are from one label to another.
-
dmat_heatmap
(selected_labels=None, col_labels=None, transform=None, title=None, xlab=None, ylab=None, figsize=(10, 10), **kwargs)[source]¶ Plot distance matrix with rows colored by current labels.
-
feature_importance_across_labs
(selected_labs, test_size=0.3, num_boost_round=10, nprocs=1, random_state=None, silent=1, xgb_params=None, num_bootstrap_round=0, bootstrap_size=None, shuffle_features=False)[source]¶ Use xgboost to determine the importance of features determining the difference between samples with different labels.
Run cross validation on dataset and obtain import features.
Parameters: - selected_labs (label list) – Labels to compare using xgboost.
- test_size (float in range (0, 1)) – Ratio of samples to be used for testing
- num_bootstrap_round (int) – Do num_bootstrap_round times of simple bootstrapping if num_bootstrap_round > 0.
- bootstrap_size (int) – The number of samples for each bootstrapping run.
- shuffle_features (bool) –
- num_boost_round (int) – The number of rounds for xgboost training.
- random_state (int) –
- nprocs (int) –
- xgb_params (dict) – Parameters for xgboost run. If None, default will be used. If provided, they will be directly used for xgbooster.
Returns: - feature_importance_list (list of feature importance of each run) – [(feature_id, fscore), …]
- bst_list (list of xgb Booster) – Fitted boost tree model
Notes
If multiple features are highly correlated, they may not all show up in the resulting tree. You could try to reduce redundant features first before comparing different clusters, or you could also interpret the important features further after obtaining the important features.
For details about xgboost parameters, check the following links:
[2] http://xgboost.readthedocs.io/en/latest/python/python_intro.html
[3] http://xgboost.readthedocs.io/en/latest/parameter.html
[4] https://xgboost.readthedocs.io/en/latest/how_to/param_tuning.html
-
feature_importance_distintuishing_labs
(selected_labs, test_size=0.3, num_boost_round=10, nprocs=1, random_state=None, silent=1, xgb_params=None, num_bootstrap_round=0, bootstrap_size=None, shuffle_features=False)[source]¶ Use xgboost to compare selected labels and others.
-
feature_importance_each_lab
(test_size=0.3, num_boost_round=10, nprocs=1, random_state=None, silent=1, xgb_params=None, num_bootstrap_round=0, bootstrap_size=None, shuffle_features=False)[source]¶ Use xgboost to compare each label with others. Experimental.
-
feature_swarm_plot
(fid, transform=None, labels=None, selected_labels=None, title=None, xlab=None, ylab=None, figsize=(10, 10))[source]¶
-
id_x
(selected_sids=None, selected_fids=None)[source]¶ Subset samples by (sample IDs, feature IDs).
Parameters: - selected_s_inds (int array) – Index array of selected samples. If is None, select all.
- selected_f_inds (int array) – Index array of selected features. If is None, select all.
Returns: subset
Return type:
-
ind_x
(selected_s_inds=None, selected_f_inds=None)[source]¶ Subset samples by (sample IDs, feature IDs).
Parameters: - selected_s_inds (int array) – Index array of selected samples. If is None, select all.
- selected_f_inds (int array) – Index array of selected features. If is None, select all.
Returns: subset
Return type:
-
labs
¶
-
merge_labels
(orig_labs_to_merge, new_lab)[source]¶ Merge selected labels into a new label
Parameters: - orig_labs_to_merge (list of unique labels) – original labels to be merged into a new label
- new_lab (label) – new label of the merged labels
Returns: None
Note
Update labels in place.
-
tsne_feature_gradient_plot
(fid, transform=None, labels=None, selected_labels=None, shuffle_label_colors=False, title=None, xlab=None, ylab=None, figsize=(20, 20), add_legend=True, n_txt_per_cluster=3, alpha=1, s=0.5, random_state=None, **kwargs)[source]¶ Plot the last t-SNE projection with the provided gradient as color.
Parameters: - fid (feature id scalar) – ID of the feature to be used for gradient plot.
- transform (callable) – Map transform on feature before plotting.
-
scedar.eda.stats module¶
-
scedar.eda.stats.
gc1d
(x)[source]¶ Compute Gini Index for 1D array.
References
[1] http://mathworld.wolfram.com/GiniCoefficient.html
[2] Damgaard, C. and Weiner, J. “Describing Inequality in Plant Size or Fecundity.” Ecology 81, 1139-1142, 2000.
[3] Dixon, P. M.; Weiner, J.; Mitchell-Olds, T.; and Woodley, R. “Bootstrapping the Gini Coefficient of Inequality.” Ecology 68, 1548-1551, 1987.
[4] Dixon, P. M.; Weiner, J.; Mitchell-Olds, T.; and Woodley, R. “Erratum to ‘Bootstrapping the Gini Coefficient of Inequality.’ ” Ecology 69, 1307, 1988.


Thank you for using Spell Numbers! Here I describe the privacy policy of Spell Numbers.
What information be collected?
Spell Numbers does not collect any user information.
Why does Spell Numbers request Camera permission?
Spell Numbers needs to use Camera for Text Recognition.
Spell Numbers does not store or send any picture taken by Camera.
How do I revoke Camera permission?
User may revoke Camera permission at anytime :
- On your device, open the main Settings app.
- Tap Apps or Application Manager depending on your device, this may look different).
- Tap "Spell Numbers" App.
- Tap Permissions.
- Next to a permission you want to turn on, move the switch to the right until it turns green. If you want to turn a permission off, move the switch to the left until it turns gray.


This is example for cards.this is the first image in container
This is example for cards.this is the second image in container
This is example for cards.this is the third image in container
This is example for cards.this is the fourth image in container
This is example for cards.this is the fifth image in container
This is example for cards.this is the sixth image in container
Table
| Name | Class | Section | Branch | ID nor | ph nor |
|---|---|---|---|---|---|
| Santoshi | a4 | cse4 | cse | 66 |<PHONE_NUMBER> |
| Santoshi | a4 | cse4 | cse | 66 |<PHONE_NUMBER> |
| Santoshi | a4 | cse4 | cse | 66 |<PHONE_NUMBER> |
| Santoshi | a4 | cse4 | cse | 66 |<PHONE_NUMBER> |
| Santoshi | a4 | cse4 | cse | 66 |<PHONE_NUMBER> |


Mark Timlin the third player to re-sign with Finn Harps for 2020
by Stephen DoyleFinn Harps have confirmed that Mark Timlin has re-signed with the club ahead of the 2020 season.
The midfielder has been at the Ballybofey club since joining on loan in 2017 from northern rivals Derry City.
The Buncrana native featured fifteen times for the Harps last season, making just ten starts and five substitute appearances.
However, his time on the pitch last season was curtailed due to injuries and Timlin is hoping that he can have a bit more luck on that front next year.
"Last season was a tough year for me personally having to sit the majority of the season out injured, but overall I was delighted to be able to contribute towards the end and help the club stay in the Premier Division," Timlin told finnharps.ie.
"Fingers crossed I can stay injury free this year and help the club push on."
The news of Timlin's re-signing comes less than a week after Ollie Horgan signed a new two-year deal to remain on as manager with the club.
Horgan echoed Timlin’s hopes for greater fortune in 2020.
"Mark had an awful time with injuries last season but in fairness to him, he worked at it and did all he could to get back on the pitch and help the lads.
"He’s probably one of our more creative players so with a bit of luck he can keep fit and give us a big boost going forward."
Gareth Harkin was the first player Horgan signed ahead of the new season and he will be counting on the midfielder's experience.
"We’re delighted to have Gareth back with us for next year," said Horgan. "He’s been a big part of the squad in our time in the Premier over the past few years and knows what it takes at this level."
The club's 2019 Player of the Season, Mark McGinley - who kept an impressive 9 clean sheets in 19 starts - has also signed up for the coming season.


--- layout: post status: publish published: true title: 2016 Cubs Predictions - Episode 8.08 author: display_name: Corey Fineran login: Corey email<EMAIL_ADDRESS>url: '' author_login: Corey author_email<EMAIL_ADDRESS>wordpress_id: 11729 wordpress_url: http://ivyenvy.com/?p=11729 date: '2016-04-03 21:19:45 +0000' date_gmt: '2016-04-04 02:19:45 +0000' categories: - Podcast tags: [] comments: - id: 22530 author: rakosnik author_email: '' author_url: http://fansperspective.net/ date: '2016-04-04 20:06:19 +0000' date_gmt: '2016-04-05 01:06:19 +0000' content: I think all of you are low on your prediction for the number of wins the Cubs will have this season. I know a lot of the experts are predicting the Cubs will win about the same number of games, but due to how polarized the National League is going to be (The Braves, Brewers, Phillies, Padres, Reds, Rockies and Marlins are all rebuilding) I'm predicting that the Cubs are going to win at least 105 games. Because of this extreme circumstance my bold prediction is that a team could win 100 games or more and miss the playoffs this season. That team might be the Cardinals. - id: 22531 author: rakosnik author_email: '' author_url: http://fansperspective.net/ date: '2016-04-04 20:17:09 +0000' date_gmt: '2016-04-05 01:17:09 +0000' content: A prediction I wanted to talk about was the number of players from this season opening day roster who won't be with the team by the end of the year. Normally there is a fair amount of turn over in a roster from the beginning of thee year to the end of the year, but this year's roster is different. Some of the players who might have gotten called up this year got called up a year early (Addison Russell and Kyle Schwarber). A number of this year's prospects are making the jump from AA to AAA (Contreras, Almora and Candelario). Of course the trade for a young, cost controlled pitcher may finally happen, but a number of the other motivations for trade have already been addressed before the season even began. This year's team is deep at nearly every position. I agree that Szczur probably won't be with the team all year long. And the bullpen probably won't carry so many pitchers all season long so something will give there too, but don't forget that this will year three of a bullpen core of Rondon, Strop, Grim and Ramirez. I wrote even wrote an article called "The Cubs 2017 Opening Day roster could be remarkably similar to their 2016 Opening Day Roster" at fansperspective.net/chicagocubs/2016/4/4/opening-day-2017-vs-2016 ---
Welcome to our annual Cubs predictions episode. This is our 386th episode.
The 2016 is a clean slate. The Cubs have a lot of expectations placed on them by fans and baseball talking heads. So how do we think the team and individual players will perform? Listen to this episode to find out.
We want to hear your opinions on these predictions. Leave them in the comments in the post for this episode. If you think we're way off in any of our predictions, leave a voicemail via our free iOS/Android app. You can also call our voicemail at<PHONE_NUMBER> and make your prediction on how many games the 2016 Cubs will win in the regular season.
Use the coupon code "2016" to save 20% on our tshirts this week at IvyEnvy.com/store.


--- layout: post title: 'Refactor: A clever way to DRY up your create action' date: 2015-02-09 18:46:40.000000000 -06:00 type: post published: true status: publish categories: - Ruby on Rails tags: [] meta: _publicize_pending: '1' is_reblog: '1' post_id: '54' blog_id: '69542792' reblog_snapshot: "O:8:\"stdClass\":7:{s:5:\"title\";s:51:\"Refactor: A clever way to DRY up your create action\";s:4:\"type\";s:4:\"post\";s:9:\"mime_type\";s:0:\"\";s:6:\"format\";b:0;s:12:\"modified_gmt\";s:19:\"2015-01-02 19:40:46\";s:9:\"permalink\";s:81:\"http://briandear.co/2015/01/02/refactor-a-clever-way-to-dry-up-your-create-action\";s:7:\"content\";s:1644:\"
class PersonController\r\n\r\n \ ...\r\n\r\n def create\r\n if person.save\r\n flash[:success] = 'Person saved!'\r\n redirect_to person\r\n else\r\n flash[:error] = 'Person not saved.'\r\n render :new\r\n end\r\n end\r\n\r\n ...\r\n\r\nend\r\n\r\nIt's probably the single most common method in a rails controller and since it follows the same pattern in each controller, it's ripe for DRYing up!\r\n\r\nHere's how:\r\n\r\nIn your application_controller.rb add the following method:\r\n
def save_and_redirect(new_object, success_msg, error_msg, redirect_path)\r\n if new_object.save\r\n flash[:success] = success_msg\r\n redirect_to redirect_path\r\n else\r\n flash[:error] = error_msg\r\n render :new\r\n end\r\nend\r\n\r\nThen in your controllers call the method like this:\r\n
def create\r\n save_and_redirect(person, 'Person added!', 'Person not added.', person)\r\n end\r\nAnd that's how it's done.\r\n\r\nAlso, in case anyone was wondering where my @person = Person.new(params[:person]) went and why I don't use instance variables; I use Decent Exposure. Check it out!\r\n\r\nHowever, the above method will also work with the more conventional create action. Simply change the controller method to this:\r\n
def create\r\n \ @person = Person.new(params[:person])\r\n save_and_redirect(@person, 'Person added!', 'Person not added.', person)\r\nend\r\n\r\n..and you're good to go.\r\n\r\nDo you have any clever refactors? Share them in the comments below..


More content in iframes
The question remains: Is this going to be inlined or is this treated as a separate document?


{% load i18n %}
{% trans "Critical" %}: {% trans "Critical production issue affecting all users, including system unavailability and data integrity issues with no workaround available." %}
{% trans "Major" %}: {% trans "Major functionality is impacted or significant performance degradation is experienced. Issue is persistent and affects many users and/or major functionality. No reasonable workaround available." %}
{% trans "Minor" %}: {% trans "System performance issue or bug affecting some but not all users. Short-term workaround is available, but not scalable." %}
{% trans "Cosmetic" %}: {% trans "Inquiry regarding a routine technical issue; information requested on application capabilities, navigation, installation or configuration; bug affecting a small number of users. Acceptable workaround available." %}


Content-type: text/html
gcc ... -ltecla -lcurses
The tecla library provides programs with interactive command line editing facilities, similar to those of the unix tcsh shell. In addition to simple command-line editing, it supports recall of previously entered command lines, TAB completion of file names or other tokens, and in-line wild-card expansion of filenames. The internal functions which perform file-name completion and wild-card expansion are also available externally for optional use by the calling program.
The various parts of the library are documented in the following man pages:
tecla(7) - Use level documentation of the command-line editing facilities provided by gl_get_line(). gl_get_line(3) - The interactive line-input module. gl_io_mode(3) - How to use gl_get_line() in an incremental, non-blocking fashion. cpl_complete_word(3) - The word completion module. ef_expand_file(3) - The filename expansion module. pca_lookup_file(3) - A directory-list based filename lookup and completion module.
In addition there is one optional application distributed with the library:
enhance(1) - Add command-line editing to third party applications.
If the library is compiled with -D_POSIX_C_SOURCE=199506L, reentrant versions of as many functions as possible are used. This includes using getpwuid_r() and getpwnam_r() instead of getpwuid() and getpwnam() when looking up the home directories of specific users in the password file (for ~user/ expansion), and readdir_r() instead of readdir() for reading directory entries when doing filename completion. The reentrant version of the library is usually called libtecla_r.a instead of libtecla.a, so if only the latter is available, it probably isn't the correct version to link with threaded programs.
Reentrant functions for iterating through the password file aren't available, so when the library is compiled to be reentrant, TAB completion of incomplete usernames in ~username/ expressions is disabled. This doesn't disable expansion of complete ~username expressions, which can be done reentrantly, or expansion of the parts of filenames that follow them, so this doesn't remove much functionality.
The terminfo functions setupterm(), tigetstr(), tigetnum() and tputs() also aren't reentrant, but very few programs will want to interact with multiple terminals, so this shouldn't prevent this library from being used in threaded programs.
The version number of the library can be queried using the following function.
void libtecla_version(int *major, int *minor, int *micro);
On return, this function records the three components of the libtecla version number in *major, *minor, *micro. The formal meaning of the three components is as follows.
major - Incrementing this number implies that a change has been made to the library's public interface, which makes it binary incompatible with programs that were linked with previous shared versions of the tecla library. minor - This number is incremented by one whenever additional functionality, such as new functions or modules, are added to the library. micro - This is incremented whenever modifications to the library are made which make no changes to the public interface, but which fix bugs and/or improve the behind-the-scenes implementation.
In Spanish, a "tecla" is the key of a keyboard. Since this library centers on keyboard input, and given that I wrote much of the library while working in Chile, this seemed like a suitable name.
libtecla.a - The tecla library. libtecla.h - The tecla header file. ~/.teclarc - The tecla personal customization file.
gl_get_line(3), tecla(7), gl_io_mode(3), ef_expand_file(3), cpl_complete_word(3), pca_lookup_file(3), enhance(1)
Markus Gyger - Lots of assistance, including help with shared libraries, configuration information, particularly for Solaris; modifications to support C++ compilers, improvements for ksh users, faster cursor motion, output buffering, and changes to make gl_get_line() 8-bit clean. Mike MacFaden - Suggestions, feedback and testing that led to many of the major new functions that were added in version 1.4.0. Tim Eliseo - Many vi-mode bindings and fixes.


|
EmbeddedAi
|
#include <factor.h>
Public Member Functions | |
| template<typename ... Args> | |
| ClauseValue (Args &&... args) | |
| Template constructor uses any of VarSet constructors and assignes value 0f 0.0F. | |
| ClauseValue (Clause cl, ValueType v) | |
| void | SetVal (ValueType v) |
| ValueType | GetVal () const |
| Public Member Functions inherited from bayeslib::Clause | |
| Clause () | |
| Clause (const VarSet &vs) | |
| Clause (const VarSet &vs, Json::Value &v) | |
| Clause (const VarSet &vs, const std::bitset< MAX_SET_SIZE > &clause) | |
| Clause (const VarSet &vs, InstanceId id) | |
| Clause (std::initializer_list< ClauseInitializer > initlist) | |
| void | AddVar (VarId id, bool bVal) |
| void | SetVar (VarId id, bool bVal) |
| bool | GetVar (VarId vid) const |
| bool | Incr () |
| bool | Decr () |
| bool | operator[] (VarId vid) const |
| const VarSet & | GetVarSet () const |
| virtual std::string | GetJson (VarDb &) const override |
| virtual std::string | GetType () const override |
| return "Clause" | |
| InstanceId | GetInstanceId () const |
| InstanceId | GetInstanceId (const VarSet &vs) const |
Protected Attributes | |
| ValueType | mVal |
| Protected Attributes inherited from bayeslib::Clause | |
| std::bitset< MAX_SET_SIZE > | mClause |
| InstanceId | mInstanceId |
| VarSet | mVarSet |
Additional Inherited Members | |
| Static Public Member Functions inherited from bayeslib::Clause | |
| static Clause | Append (VarSet target, const Clause &cl1, const Clause &cl2) |
| Protected Member Functions inherited from bayeslib::Clause | |
| void | UpdateClause () |
Combination od Clause and ValueType assigned to the Clause It conceptually represents entire row in a Factor
|
inline |
Constructs ClauseValue using Clause and ValueType
| cl | Clause of this ClauseValue |
| v | Value that will be assigned to this clause |
|
inline |
Get Value assigned to this CaluseVal
|
inline |
Set valuse associated to this clause
| v | Value to assign to this clause |


STAT
Section: User Commands (1)Updated: June 2012
Index Return to Main Contents
NAME
stat - display file or file system statusSYNOPSIS
stat [OPTION]... FILE...DESCRIPTION
Display file or file system status.
- -L, --dereference
- follow links
- -Z, --context
- print the SELinux security context
- -f, --file-system
- display file system status instead of file status
- -c --format=FORMAT
- use the specified FORMAT instead of the default; output a newline after each use of FORMAT
- --printf=FORMAT
- like --format, but interpret backslash escapes, and do not output a mandatory trailing newline. If you want a newline, include \n in FORMAT.
- -t, --terse
- print the information in terse form
- --help
- display this help and exit
- --version
- output version information and exit
The valid format sequences for files (without --file-system):
- %a
- Access rights in octal
- %A
- Access rights in human readable form
- %b
- Number of blocks allocated (see %B)
- %B
- The size in bytes of each block reported by %b
- %C
- SELinux security context string
- %d
- Device number in decimal
- %D
- Device number in hex
- %f
- Raw mode in hex
- %F
- File type
- %g
- Group ID of owner
- %G
- Group name of owner
- %h
- Number of hard links
- %i
- Inode number
- %n
- File name
- %N
- Quoted file name with dereference if symbolic link
- %o
- I/O block size
- %s
- Total size, in bytes
- %t
- Major device type in hex
- %T
- Minor device type in hex
- %u
- User ID of owner
- %U
- User name of owner
- %x
- Time of last access
- %X
- Time of last access as seconds since Epoch
- %y
- Time of last modification
- %Y
- Time of last modification as seconds since Epoch
- %z
- Time of last change
- %Z
- Time of last change as seconds since Epoch
Valid format sequences for file systems:
- %a
- Free blocks available to non-superuser
- %b
- Total data blocks in file system
- %c
- Total file nodes in file system
- %d
- Free file nodes in file system
- %f
- Free blocks in file system
- %C
- SELinux security context string
- %i
- File System ID in hex
- %l
- Maximum length of filenames
- %n
- File name
- %s
- Block size (for faster transfers)
- %S
- Fundamental block size (for block counts)
- %t
- Type in hex
- %T
- Type in human readable form
NOTE: your shell may have its own version of stat, which usually supersedes the version described here. Please refer to your shell's documentation for details about the options it supports.
AUTHOR
Written by Michael Meskes.REPORTING BUGS
Report stat bugs to<EMAIL_ADDRESS>coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
Report stat translation bugs to <http://translationproject.org/team/>
COPYRIGHT
Copyright © 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
SEE ALSO
stat(2)The full documentation for stat is maintained as a Texinfo manual. If the info and stat programs are properly installed at your site, the command
- info coreutils aqstat invocationaq
should give you access to the complete manual.
Index
This document was created by man2html, using the manual pages.
Time: 05:29:11 GMT, December 24, 2015


Gateway
BOT
19-Aug-18 12:03 PM
[dscrdeql] <CowboyCrypto- Founder> Morning
[dscrdeql] <SwimedDragon> Good morning Cowboy
[dscrdeql] <CowboyCrypto- Founder> How’s it goin
[dscrdeql] <SwimedDragon> Pretty good, waiting for family to come over, my sister. She's known to come late, every single time haha. This time we were too late with grocery shopping but we figured she wouldn't be here by the time we came back. And that's about an hour ago haha. How's your morning going?
[dscrdeql] <CowboyCrypto- Founder> 7am here. I am about to go pick up a car to work on then I’m off running to buy 2-3 more
[dscrdeql] <SwimedDragon> I'm looking at some of the markets prices of coins, I'm surprised EQLI is still this cheap =O
Already Monday morning?
[dscrdeql] <CowboyCrypto- Founder> Nah it’s Sunday
[dscrdeql] <CowboyCrypto- Founder> No rest for me lol
[dscrdeql] <SwimedDragon> Ah I see, I was surprised since it's just 2 pm over here. What kind of cars are you going to buy?
[dscrdeql] <CowboyCrypto- Founder> Silverado and another Denali
[dscrdeql] <CowboyCrypto- Founder> Easy sells
[dscrdeql] <CowboyCrypto- Founder> Hoping to have them both sold by weds
[dscrdeql] <SwimedDragon> Wouldn't be too hard right?
[dscrdeql] <CowboyCrypto- Founder> Nah
[dscrdeql] <CowboyCrypto- Founder> I’m a sales guy so it’s my thing lol
[dscrdeql] <SwimedDragon> Do you only sell cars or also other things?
[dscrdeql] <SwimedDragon> My grandfather had a store where he sold mainly second hand items, but he already died when I was very young. I wish he would have lived longer because even though I suck at selling things right now, I still seem to have a certain feel for it. I would have loved to see him at work. I was only 5 when he died, but I still remember where he had his shop


This example shows the drag&drop capabilities of Telerik TreeView for ASP.NET MVC.
To allow reordering of the TreeView nodes, all you need to do is to call DragAndDrop(true).
If you want to process any user action (i.e. so that you save it to a database), you have to attach handlers to the drag&drop client-side events, namely:
You can provide contextual drag clues with less code by providing a CSS selector to the DropTargets property, like this:
<%= Html.Telerik().TreeView() .Name("TreeView") .DragAndDrop(settings => settings .DropTargets(".drop-container") ) .Items(items => { /*items definition*/ }) %>


Web site design and promotion
Soft Union is a collective of website designers. We concentrate
on developing and promoting websites of high social value.
If you would like to use our services to develop a website that would
carry important ideas in an artistically attractive way, and make it
highly visible on the Web, please
send us mail with description of your materials and goals, and we will
respond with suggestions on what we can do for you.


The rprojroot package solves a seemingly trivial but annoying problem that occurs sooner or later in any largish project: How to find files in subdirectories? Ideally, file paths are relative to the project root.
Unfortunately, we cannot always be sure about the current working directory: For instance, in RStudio it’s sometimes:
basename(getwd())
## [1] "vignettes"
In some cases, it’s even outside the project root.
This vignette starts with a very brief summary that helps you get started, followed by a longer description of the features.
What is your project: An R package?
::is_r_package rprojroot
## Root criterion: contains a file "DESCRIPTION" with contents matching "^Package: "
Or an RStudio project?
::is_rstudio_project rprojroot
## Root criterion: contains a file matching "[.]Rproj$" with contents matching "^Version: " in the first line
Or something else?
::has_file(".git/index") rprojroot
## Root criterion: contains a file ".git/index"
For now, we assume it’s an R package:
<- rprojroot::is_r_package root
The root
object contains a function that helps locating files below the root of your package, regardless of your current working directory. If you are sure that your working directory is somewhere below your project’s root, use the root$find_file()
function. In this example here, we’re starting in the vignettes
subdirectory and find the original DESCRIPTION
file:
basename(getwd())
## [1] "vignettes"
readLines(root$find_file("DESCRIPTION"), 3)
## [1] "Package: rprojroot"
## [2] "Title: Finding Files in Project Subdirectories"
## [3] "Version: 2.0.2"
There is one exception: if the first component passed to find_file()
is already an absolute path. This allows safely applying this function to paths that may be absolute or relative:
<- root$find_file()
path readLines(root$find_file(path, "DESCRIPTION"), 3)
## [1] "Package: rprojroot"
## [2] "Title: Finding Files in Project Subdirectories"
## [3] "Version: 2.0.2"
You can also construct an accessor to your root using the root$make_fix_file()
function:
<- root$make_fix_file() root_file
Note that root_file()
is a function that works just like $find_file()
but will find the files even if the current working directory is outside your project:
::with_dir(
withr"../..",
readLines(root_file("DESCRIPTION"), 3)
)
## [1] "Package: rprojroot"
## [2] "Title: Finding Files in Project Subdirectories"
## [3] "Version: 2.0.2"
If you know the absolute path of some directory below your project, but cannot be sure of your current working directory, pass that absolute path to root$make_fix_file()
:
<- root$make_fix_file("C:\\Users\\User Name\\...") root_file
As a last resort, you can get the path of standalone R scripts or vignettes using the thisfile()
function:
<- root$make_fix_file(dirname(thisfile())) root_file
The remainder of this vignette describes implementation details and advanced features.
We assume a self-contained project where all files and directories are located below a common root directory. Also, there should be a way to unambiguously identify this root directory. (Often, the root contains a regular file whose name matches a given pattern, and/or whose contents match another pattern.) In this case, the following method reliably finds our project root:
The Git version control system (and probably many other tools) use a similar approach: A Git command can be executed from within any subdirectory of a repository.
The find_root()
function implements the core functionality. It returns the path to the first directory that matches the filtering criteria, or throws an error if there is no such directory. Filtering criteria are constructed in a generic fashion using the root_criterion()
function, the has_file()
function constructs a criterion that checks for the presence of a file with a specific name and specific contents.
library(rprojroot)
# List all files and directories below the root
dir(find_root(has_file("DESCRIPTION")))
## [1] "CRAN-RELEASE" "DESCRIPTION" "LICENSE" "LICENSE.md"
## [5] "NAMESPACE" "NEWS.md" "R" "README.Rmd"
## [9] "README.md" "TODO.md" "_pkgdown.yml" "codecov.yml"
## [13] "cran-comments.md" "docs" "inst" "man"
## [17] "revdep" "rprojroot.Rcheck" "rprojroot.Rproj" "tests"
## [21] "vignettes"
Here we illustrate the power of rprojroot by demonstrating how to access the same file from two different working directories. Let your project be a package called pkgname
and consider the desired file rrmake.R
at pkgname/R/rrmake.R
. First, we show how to access from the vignettes
directory, and then from the tests/testthat
directory.
vignettes
When your working directory is pkgname/vignettes
, you can access the rrmake.R
file by:
<- "../R/rrmake.R"
rel_path_from_vignettes <- file.path("..", "R", "rrmake.R") ##identical rel_path_from_vignettes
<- "R/rrmake.R"
rel_path_from_root <- file.path("R", "rrmake.R") ##identical rel_path_from_root
This second method requires finding the root of the package, which can be done with the has_file()
function:
has_file("DESCRIPTION")
## Root criterion: contains a file "DESCRIPTION"
So, using rprojroot you can specify the path relative from root in the following manner:
# Specify a path/to/file relative to the root
<- find_root_file("R", "rrmake.R", criterion = has_file("DESCRIPTION")) rel_path_from_root
tests/testthat
When your working directory is pkgname/tests/testthat
, you can access the rrmake.R
file by:
<- "../../R/rrmake.R" rel_path_from_testthat
Note that this is different than in the previous example! However, the second method is the same…
# Specify a path/to/file relative to the root
<- find_root_file("R", "rrmake.R", criterion = has_file("DESCRIPTION")) rel_path_from_root
Since Examples A and B used different working directories, rel_path_from_vignettes
and rel_path_from_testthat
were different. This is an issue when trying to re-use the same code. This issue is solved by using rprojroot: the function find_root_file()
finds a file relative from the root, where the root is determined from checking the criterion with has_file()
.
Note that the follow code produces identical results when building the vignette and when sourcing the chunk in RStudio, provided that the current working directory is the project root or anywhere below. So, we can check to make sure that rprojroot has successfully determined the correct path:
# Specify a path/to/file relative to the root
<- find_root_file("R", "rrmake.R", criterion = has_file("DESCRIPTION"))
rel_path_from_root
# Find a file relative to the root
file.exists(rel_path_from_root)
## [1] FALSE
The has_file()
function (and the more general root_criterion()
) both return an S3 object of class root_criterion
:
has_file("DESCRIPTION")
## Root criterion: contains a file "DESCRIPTION"
In addition, character values are coerced to has_file
criteria by default, this coercion is applied automatically by find_root()
. (This feature is used by the introductory example.)
as_root_criterion("DESCRIPTION")
## Root criterion: contains a file "DESCRIPTION"
The return value of these functions can be stored and reused; in fact, the package provides 9 such criteria:
criteria
## $is_rstudio_project
## Root criterion: contains a file matching "[.]Rproj$" with contents matching "^Version: " in the first line
##
## $is_r_package
## Root criterion: contains a file "DESCRIPTION" with contents matching "^Package: "
##
## $is_remake_project
## Root criterion: contains a file "remake.yml"
##
## $is_projectile_project
## Root criterion: contains a file ".projectile"
##
## $is_git_root
## Root criterion: one of
## - contains a directory ".git"
## - contains a file ".git" with contents matching "^gitdir: "
##
## $is_svn_root
## Root criterion: contains a directory ".svn"
##
## $is_vcs_root
## Root criterion: one of
## - contains a directory ".git"
## - contains a file ".git" with contents matching "^gitdir: "
## - contains a directory ".svn"
##
## $is_testthat
## Root criterion: directory name is "testthat" (also look in subdirectories: `tests/testthat`, `testthat`)
##
## $from_wd
## Root criterion: from current working directory
##
## attr(,"class")
## [1] "root_criteria"
Defining new criteria is easy:
<- has_file("LICENSE")
has_license has_license
## Root criterion: contains a file "LICENSE"
<- has_file("config/global.dcf", "^version: ")
is_projecttemplate_project is_projecttemplate_project
## Root criterion: contains a file "config/global.dcf" with contents matching "^version: "
You can also combine criteria via the |
operator:
| is_rstudio_project is_r_package
## Root criterion: one of
## - contains a file "DESCRIPTION" with contents matching "^Package: "
## - contains a file matching "[.]Rproj$" with contents matching "^Version: " in the first line
To avoid specifying the search criteria for the project root every time, shortcut functions can be created. The find_package_root_file()
is a shortcut for find_root_file(..., criterion = is_r_package)
:
# Print first lines of the source for this document
head(readLines(find_package_root_file("vignettes", "rprojroot.Rmd")))
## [1] "---"
## [2] "title: \"Finding files in project subdirectories\""
## [3] "author: \"Kirill Müller\""
## [4] "date: \"`r Sys.Date()`\""
## [5] "output: rmarkdown::html_vignette"
## [6] "vignette: >"
To save typing effort, define a shorter alias:
<- find_package_root_file
P
# Use a shorter alias
file.exists(P("vignettes", "rprojroot.Rmd"))
## [1] TRUE
Each criterion actually contains a function that allows finding a file below the root specified by this criterion. As our project does not have a file named LICENSE
, querying the root results in an error:
# Use the has_license criterion to find the root
<- has_license$find_file
R R
## function (..., path = ".")
## {
## find_root_file(..., criterion = criterion, path = path)
## }
## <environment: 0x55a1084b4c90>
# Our package does not have a LICENSE file, trying to find the root results in an error
R()
## [1] "/tmp/RtmpSlm2Cl/Rbuild516c5ebd7779/rprojroot"
We can also create a function that computes a path relative to the root at creation time.
# Define a function that computes file paths below the current root
<- is_r_package$make_fix_file()
F F
## function (...)
## {
## if (!missing(..1)) {
## abs <- is_absolute_path(..1)
## if (all(abs)) {
## return(path(...))
## }
## if (any(abs)) {
## stop("Combination of absolute and relative paths not supported.",
## call. = FALSE)
## }
## }
## path("/tmp/RtmpSlm2Cl/Rbuild516c5ebd7779/rprojroot", ...)
## }
## <environment: 0x55a10635d6a8>
# Show contents of the NAMESPACE file in our project
readLines(F("NAMESPACE"))
## [1] "# Generated by roxygen2: do not edit by hand"
## [2] ""
## [3] "S3method(\"|\",root_criterion)"
## [4] "S3method(as_root_criterion,character)"
## [5] "S3method(as_root_criterion,default)"
## [6] "S3method(as_root_criterion,root_criterion)"
## [7] "S3method(format,root_criterion)"
## [8] "S3method(print,root_criterion)"
## [9] "S3method(str,root_criteria)"
## [10] "export(as.root_criterion)"
## [11] "export(as_root_criterion)"
## [12] "export(criteria)"
## [13] "export(find_package_root_file)"
## [14] "export(find_remake_root_file)"
## [15] "export(find_root)"
## [16] "export(find_root_file)"
## [17] "export(find_rstudio_root_file)"
## [18] "export(find_testthat_root_file)"
## [19] "export(from_wd)"
## [20] "export(get_root_desc)"
## [21] "export(has_basename)"
## [22] "export(has_dir)"
## [23] "export(has_file)"
## [24] "export(has_file_pattern)"
## [25] "export(is.root_criterion)"
## [26] "export(is_drake_project)"
## [27] "export(is_git_root)"
## [28] "export(is_projectile_project)"
## [29] "export(is_r_package)"
## [30] "export(is_remake_project)"
## [31] "export(is_root_criterion)"
## [32] "export(is_rstudio_project)"
## [33] "export(is_svn_root)"
## [34] "export(is_testthat)"
## [35] "export(is_vcs_root)"
## [36] "export(root_criterion)"
## [37] "export(thisfile)"
## [38] "export(thisfile_knit)"
## [39] "export(thisfile_r)"
## [40] "export(thisfile_rscript)"
## [41] "export(thisfile_source)"
## [42] "importFrom(utils,str)"
## [43] "importFrom(utils,tail)"
This is a more robust alternative to $find_file()
, because it fixes the project directory when $make_fix_file()
is called, instead of searching for it every time. (For that reason it is also slightly faster, but I doubt this matters in practice.)
This function can be used even if we later change the working directory to somewhere outside the project:
# Print the size of the namespace file, working directory outside the project
::with_dir(
withr"../..",
file.size(F("NAMESPACE"))
)
## [1] 1070
The make_fix_file()
member function also accepts an optional path
argument, in case you know your project’s root but the current working directory is somewhere outside. The path to the current script or knitr
document can be obtained using the thisfile()
function, but it’s much easier and much more robust to just run your scripts with the working directory somewhere below your project root.
testthat
filesTests run with testthat
commonly use files that live below the tests/testthat
directory. Ideally, this should work in the following situation:
devtools::test()
(working directory: tests/testthat
)R CMD check
(working directory: a renamed recursive copy of tests
)The is_testthat
criterion allows robust lookup of test files.
is_testthat
## Root criterion: directory name is "testthat" (also look in subdirectories: `tests/testthat`, `testthat`)
The example code below lists all files in the hierarchy test directory. It uses two project root lookups in total, so that it also works when rendering the vignette (sigh):
dir(is_testthat$find_file("hierarchy", path = is_r_package$find_file()))
## [1] "DESCRIPTION" "a" "b" "c"
## [5] "hierarchy.Rproj"
The hassle of using saved data files for testing is made even easier by using rprojroot in a utility function. For example, suppose you have a testing file at tests/testthat/test_my_fun.R
which tests the my_fun()
function:
<- do.call(my_fun, my_args)
my_fun_run
::test_that(
testthat"my_fun() returns expected output",
::expect_equal(
testthat
my_fun_run,
expected_output
) )
There are two pieces of information that you’ll need every time test_my_fun.R
is run: my_args
and expected_output
. Typically, these objects are saved to .Rdata
files and saved to the same subdirectory. For example, you could save them to my_args.Rdata
and expected_output.Rdata
under the tests/testthat/testing_data
subdirectory. And, to find them easily in any contexts, you can use rprojroot!
Since all of the data files live in the same subdirectory, you can create a utility function get_my_path()
that will always look in that directory for these types of files. And, since the testthat package will look for and source the tests/testthat/helper.R
file before running any tests, you can place a get_my_path()
in this file and use it throughout your tests:
## saved to tests/testthat/helper.R
<- function(file_name) {
get_my_path ::find_testthat_root_file(
rprojroot"testing_data", filename
) }
Now you can ask get_my_path()
to find your important data files by using the function within your test scripts!
## Find the correct path with your custom rprojroot helper function
<- get_my_path("my_args.Rdata")
path_to_my_args_file
## Load the input arguments
load(file = path_to_my_args_file)
## Run the function with those arguments
<- do.call(my_fun,my_args)
my_fun_run
## Load the historical expectation with the helper
load(file = get_my_path("expected_output.Rdata"))
## Pass all tests and achieve nirvana
::test_that(
testthat"my_fun() returns expected output",
::expect_equal(
testthat
my_fun_run,
expected_output
) )
For an example in the wild, see the test_sheet()
function in the readxl package.
The rprojroot package allows easy access to files below a project root if the project root can be identified easily, e.g. if it is the only directory in the whole hierarchy that contains a specific file. This is a robust solution for finding files in largish projects with a subdirectory hierarchy if the current working directory cannot be assumed fixed. (However, at least initially, the current working directory must be somewhere below the project root.)
This package was inspired by the gist “Stop the working directory insanity” by Jennifer Bryan, and by the way Git knows where its files are.


Platform providing services that have material impact on the basic needs of budding entrepreneurs by presenting great opportunities.
Provides user friendly interface to make your stock market experience time saving and beneficial. User interests are given top priority.
We have provided detailed documentation on start up companies and sponsors documented for a easier browsing experience.
Our support staffs will help you out with any queries related to the information provided. We also provide support through phone and live chats. We also offer email support. You can get some help from the FAQs section.


The Twitter accounts relating to Faculty of Science are list as follow:
Numberof followers:
Numberof followings:


--- layout: page title: Lean Prover Zulip Chat Archive permalink: archive/113488general/11313booleanring.html ---
Do we know that Prop or bool is a comm_ring?
Prop
bool
Maybe not as an instance, but as a def?
def
We know zmod 2 is
zmod 2