_id
stringlengths
5
9
text
stringlengths
5
385k
title
stringclasses
1 value
doc_27600
Densely Connected Convolutional Networks (CVPR 2017) Functions DenseNet121(...): Instantiates the Densenet121 architecture. DenseNet169(...): Instantiates the Densenet169 architecture. DenseNet201(...): Instantiates the Densenet201 architecture. decode_predictions(...): Decodes the prediction of an ImageNet model. preprocess_input(...): Preprocesses a tensor or Numpy array encoding a batch of images.
doc_27601
Get the artist's bounding box in display space. The bounding box' width and height are nonnegative. Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0. Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.
doc_27602
A string representing the MIME type of the request, parsed from the CONTENT_TYPE header.
doc_27603
This is the quantized version of InstanceNorm3d. Additional args: scale - quantization scale of the output, type: double. zero_point - quantization zero point of the output, type: long.
doc_27604
The HTTP status used for error responses. This should be a status string as defined in PEP 3333; it defaults to a 500 code and message.
doc_27605
A QuerySet that represents the objects. If provided, the value of queryset supersedes the value provided for model. Warning queryset is a class attribute with a mutable value so care must be taken when using it directly. Before using it, either call its all() method or retrieve it with get_queryset() which takes care of the cloning behind the scenes.
doc_27606
tf.metrics.MeanAbsoluteError Compat aliases for migration See Migration guide for more details. tf.compat.v1.keras.metrics.MeanAbsoluteError tf.keras.metrics.MeanAbsoluteError( name='mean_absolute_error', dtype=None ) Args name (Optional) string name of the metric instance. dtype (Optional) data type of the metric result. Standalone usage: m = tf.keras.metrics.MeanAbsoluteError() m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]]) m.result().numpy() 0.25 m.reset_states() m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]], sample_weight=[1, 0]) m.result().numpy() 0.5 Usage with compile() API: model.compile( optimizer='sgd', loss='mse', metrics=[tf.keras.metrics.MeanAbsoluteError()]) Methods reset_states View source reset_states() Resets all of the metric state variables. This function is called between epochs/steps, when a metric is evaluated during training. result View source result() Computes and returns the metric value tensor. Result computation is an idempotent operation that simply calculates the metric value using the state variables. update_state View source update_state( y_true, y_pred, sample_weight=None ) Accumulates metric statistics. y_true and y_pred should have the same shape. Args y_true Ground truth values. shape = [batch_size, d0, .. dN]. y_pred The predicted values. shape = [batch_size, d0, .. dN]. sample_weight Optional sample_weight acts as a coefficient for the metric. If a scalar is provided, then the metric is simply scaled by the given value. If sample_weight is a tensor of size [batch_size], then the metric for each sample of the batch is rescaled by the corresponding element in the sample_weight vector. If the shape of sample_weight is [batch_size, d0, .. dN-1] (or can be broadcasted to this shape), then each metric element of y_pred is scaled by the corresponding value of sample_weight. (Note on dN-1: all metric functions reduce by 1 dimension, usually the last axis (-1)). Returns Update op.
doc_27607
The string value to replace sensitive value with. By default it replaces the values of sensitive variables with stars (**********).
doc_27608
Return a random floating point number N such that low <= N <= high and with the specified mode between those bounds. The low and high bounds default to zero and one. The mode argument defaults to the midpoint between the bounds, giving a symmetric distribution.
doc_27609
If the debugger should stop at this exception, invokes the user_exception() method (which should be overridden in subclasses). Raise a BdbQuit exception if the Bdb.quitting flag is set (which can be set from user_exception()). Return a reference to the trace_dispatch() method for further tracing in that scope.
doc_27610
Report that the test runner is about to process the given example. This method is provided to allow subclasses of DocTestRunner to customize their output; it should not be called directly. example is the example about to be processed. test is the test containing example. out is the output function that was passed to DocTestRunner.run().
doc_27611
Set the DataFrame index using existing columns. Set the DataFrame index (row labels) using one or more existing columns or arrays (of the correct length). The index can replace the existing index or expand on it. Parameters keys:label or array-like or list of labels/arrays This parameter can be either a single column key, a single array of the same length as the calling DataFrame, or a list containing an arbitrary combination of column keys and arrays. Here, “array” encompasses Series, Index, np.ndarray, and instances of Iterator. drop:bool, default True Delete columns to be used as the new index. append:bool, default False Whether to append columns to existing index. inplace:bool, default False If True, modifies the DataFrame in place (do not create a new object). verify_integrity:bool, default False Check the new index for duplicates. Otherwise defer the check until necessary. Setting to False will improve the performance of this method. Returns DataFrame or None Changed row labels or None if inplace=True. See also DataFrame.reset_index Opposite of set_index. DataFrame.reindex Change to new indices or expand indices. DataFrame.reindex_like Change to same indices as other DataFrame. Examples >>> df = pd.DataFrame({'month': [1, 4, 7, 10], ... 'year': [2012, 2014, 2013, 2014], ... 'sale': [55, 40, 84, 31]}) >>> df month year sale 0 1 2012 55 1 4 2014 40 2 7 2013 84 3 10 2014 31 Set the index to become the ‘month’ column: >>> df.set_index('month') year sale month 1 2012 55 4 2014 40 7 2013 84 10 2014 31 Create a MultiIndex using columns ‘year’ and ‘month’: >>> df.set_index(['year', 'month']) sale year month 2012 1 55 2014 4 40 2013 7 84 2014 10 31 Create a MultiIndex using an Index and a column: >>> df.set_index([pd.Index([1, 2, 3, 4]), 'year']) month sale year 1 2012 1 55 2 2014 4 40 3 2013 7 84 4 2014 10 31 Create a MultiIndex using two Series: >>> s = pd.Series([1, 2, 3, 4]) >>> df.set_index([s, s**2]) month year sale 1 1 1 2012 55 2 4 4 2014 40 3 9 7 2013 84 4 16 10 2014 31
doc_27612
Get the text of the label.
doc_27613
Tracer is the class that implements the symbolic tracing functionality of torch.fx.symbolic_trace. A call to symbolic_trace(m) is equivalent to Tracer().trace(m). Tracer can be subclassed to override various behaviors of the tracing process. The different behaviors that can be overridden are described in the docstrings of the methods on this class. call_module(m, forward, args, kwargs) [source] Method that specifies the behavior of this Tracer when it encounters a call to an nn.Module instance. By default, the behavior is to check if the called module is a leaf module via is_leaf_module. If it is, emit a call_module node referring to m in the Graph. Otherwise, call the Module normally, tracing through the operations in its forward function. This method can be overridden to–for example–create nested traced GraphModules, or any other behavior you would want while tracing across Module boundaries. Module boundaries. Parameters m (Module) – The module for which a call is being emitted forward (Callable) – The forward() method of the Module to be invoked args (Tuple) – args of the module callsite kwargs (Dict) – kwargs of the module callsite Returns The return value from the Module call. In the case that a call_module node was emitted, this is a Proxy value. Otherwise, it is whatever value was returned from the Module invocation. create_arg(a) [source] A method to specify the behavior of tracing when preparing values to be used as arguments to nodes in the Graph. By default, the behavior includes: Iterate through collection types (e.g. tuple, list, dict) and recursively call create_args on the elements. Given a Proxy object, return a reference to the underlying IR Node Given a non-Proxy Tensor object, emit IR for various cases: For a Parameter, emit a get_attr node referring to that Parameter For a non-Parameter Tensor, store the Tensor away in a special attribute referring to that attribute. This method can be overridden to support more types. Parameters a (Any) – The value to be emitted as an Argument in the Graph. Returns The value a converted into the appropriate Argument create_args_for_root(root_fn, is_module, concrete_args=None) [source] Create placeholder nodes corresponding to the signature of the root Module. This method introspects root’s signature and emits those nodes accordingly, also supporting *args and **kwargs. is_leaf_module(m, module_qualified_name) [source] A method to specify whether a given nn.Module is a “leaf” module. Leaf modules are the atomic units that appear in the IR, referenced by call_module calls. By default, Modules in the PyTorch standard library namespace (torch.nn) are leaf modules. All other modules are traced through and their constituent ops are recorded, unless specified otherwise via this parameter. Parameters m (Module) – The module being queried about module_qualified_name (str) – The path to root of this module. For example, if you have a module hierarchy where submodule foo contains submodule bar, which contains submodule baz, that module will appear with the qualified name foo.bar.baz here. path_of_module(mod) [source] Helper method to find the qualified name of mod in the Module hierarchy of root. For example, if root has a submodule named foo, which has a submodule named bar, passing bar into this function will return the string “foo.bar”. Parameters mod (str) – The Module to retrieve the qualified name for. trace(root, concrete_args=None) [source] Trace root and return the corresponding FX Graph representation. root can either be an nn.Module instance or a Python callable. Note that after this call, self.root may be different from the root passed in here. For example, when a free function is passed to trace(), we will create an nn.Module instance to use as the root and add embedded constants to. Parameters root (Union[Module, Callable]) – Either a Module or a function to be traced through. Returns A Graph representing the semantics of the passed-in root.
doc_27614
Only used when a custom intermediary model is specified. Django will normally determine which fields of the intermediary model to use in order to establish a many-to-many relationship automatically. However, consider the following models: from django.db import models class Person(models.Model): name = models.CharField(max_length=50) class Group(models.Model): name = models.CharField(max_length=128) members = models.ManyToManyField( Person, through='Membership', through_fields=('group', 'person'), ) class Membership(models.Model): group = models.ForeignKey(Group, on_delete=models.CASCADE) person = models.ForeignKey(Person, on_delete=models.CASCADE) inviter = models.ForeignKey( Person, on_delete=models.CASCADE, related_name="membership_invites", ) invite_reason = models.CharField(max_length=64) Membership has two foreign keys to Person (person and inviter), which makes the relationship ambiguous and Django can’t know which one to use. In this case, you must explicitly specify which foreign keys Django should use using through_fields, as in the example above. through_fields accepts a 2-tuple ('field1', 'field2'), where field1 is the name of the foreign key to the model the ManyToManyField is defined on (group in this case), and field2 the name of the foreign key to the target model (person in this case). When you have more than one foreign key on an intermediary model to any (or even both) of the models participating in a many-to-many relationship, you must specify through_fields. This also applies to recursive relationships when an intermediary model is used and there are more than two foreign keys to the model, or you want to explicitly specify which two Django should use.
doc_27615
Performs linear Principal Component Analysis (PCA) on a low-rank matrix, batches of such matrices, or sparse matrix. This function returns a namedtuple (U, S, V) which is the nearly optimal approximation of a singular value decomposition of a centered matrix AA such that A=Udiag(S)VTA = U diag(S) V^T . Note The relation of (U, S, V) to PCA is as follows: AA is a data matrix with m samples and n features the VV columns represent the principal directions S∗∗2/(m−1)S ** 2 / (m - 1) contains the eigenvalues of ATA/(m−1)A^T A / (m - 1) which is the covariance of A when center=True is provided. matmul(A, V[:, :k]) projects data to the first k principal components Note Different from the standard SVD, the size of returned matrices depend on the specified rank and q values as follows: UU is m x q matrix SS is q-vector VV is n x q matrix Note To obtain repeatable results, reset the seed for the pseudorandom number generator Parameters A (Tensor) – the input tensor of size (∗,m,n)(*, m, n) q (int, optional) – a slightly overestimated rank of AA . By default, q = min(6, m, n). center (bool, optional) – if True, center the input tensor, otherwise, assume that the input is centered. niter (int, optional) – the number of subspace iterations to conduct; niter must be a nonnegative integer, and defaults to 2. References: - Nathan Halko, Per-Gunnar Martinsson, and Joel Tropp, Finding structure with randomness: probabilistic algorithms for constructing approximate matrix decompositions, arXiv:0909.4061 [math.NA; math.PR], 2009 (available at `arXiv <http://arxiv.org/abs/0909.4061>`_).
doc_27616
The index after the last invalid data in object.
doc_27617
Alias for set_fontproperties.
doc_27618
The first child of the node, if there are any, or None. This is a read-only attribute.
doc_27619
tf.experimental.numpy.finfo( dtype ) Note that currently it just forwards to the numpy namesake, while tensorflow and numpy dtypes may have different properties. See the NumPy documentation for numpy.finfo.
doc_27620
This function returns an object that describes the resources consumed by either the current process or its children, as specified by the who parameter. The who parameter should be specified using one of the RUSAGE_* constants described below. A simple example: from resource import * import time # a non CPU-bound task time.sleep(3) print(getrusage(RUSAGE_SELF)) # a CPU-bound task for i in range(10 ** 8): _ = 1 + 1 print(getrusage(RUSAGE_SELF)) The fields of the return value each describe how a particular system resource has been used, e.g. amount of time spent running is user mode or number of times the process was swapped out of main memory. Some values are dependent on the clock tick internal, e.g. the amount of memory the process is using. For backward compatibility, the return value is also accessible as a tuple of 16 elements. The fields ru_utime and ru_stime of the return value are floating point values representing the amount of time spent executing in user mode and the amount of time spent executing in system mode, respectively. The remaining values are integers. Consult the getrusage(2) man page for detailed information about these values. A brief summary is presented here: Index Field Resource 0 ru_utime time in user mode (float seconds) 1 ru_stime time in system mode (float seconds) 2 ru_maxrss maximum resident set size 3 ru_ixrss shared memory size 4 ru_idrss unshared memory size 5 ru_isrss unshared stack size 6 ru_minflt page faults not requiring I/O 7 ru_majflt page faults requiring I/O 8 ru_nswap number of swap outs 9 ru_inblock block input operations 10 ru_oublock block output operations 11 ru_msgsnd messages sent 12 ru_msgrcv messages received 13 ru_nsignals signals received 14 ru_nvcsw voluntary context switches 15 ru_nivcsw involuntary context switches This function will raise a ValueError if an invalid who parameter is specified. It may also raise error exception in unusual circumstances.
doc_27621
Fiscal year the Period lies in according to its starting-quarter. The year and the qyear of the period will be the same if the fiscal and calendar years are the same. When they are not, the fiscal year can be different from the calendar year of the period. Returns int The fiscal year of the period. See also Period.year Return the calendar year of the period. Examples If the natural and fiscal year are the same, qyear and year will be the same. >>> per = pd.Period('2018Q1', freq='Q') >>> per.qyear 2018 >>> per.year 2018 If the fiscal year starts in April (Q-MAR), the first quarter of 2018 will start in April 2017. year will then be 2018, but qyear will be the fiscal year, 2018. >>> per = pd.Period('2018Q1', freq='Q-MAR') >>> per.start_time Timestamp('2017-04-01 00:00:00') >>> per.qyear 2018 >>> per.year 2017
doc_27622
Return whether ticks are drawn inside or outside the axes.
doc_27623
Called when the transport’s buffer drains below the low watermark.
doc_27624
See Migration guide for more details. tf.compat.v1.raw_ops.QueueEnqueue tf.raw_ops.QueueEnqueue( handle, components, timeout_ms=-1, name=None ) The components input has k elements, which correspond to the components of tuples stored in the given queue. N.B. If the queue is full, this operation will block until the given element has been enqueued (or 'timeout_ms' elapses, if specified). Args handle A Tensor of type mutable string. The handle to a queue. components A list of Tensor objects. One or more tensors from which the enqueued tensors should be taken. timeout_ms An optional int. Defaults to -1. If the queue is full, this operation will block for up to timeout_ms milliseconds. Note: This option is not supported yet. name A name for the operation (optional). Returns The created Operation.
doc_27625
Gathers a list of tensors in a single process. Parameters tensor (Tensor) – Input tensor. gather_list (list[Tensor], optional) – List of appropriately-sized tensors to use for gathered data (default is None, must be specified on the destination rank) dst (int, optional) – Destination rank (default is 0) group (ProcessGroup, optional) – The process group to work on. If None, the default process group will be used. async_op (bool, optional) – Whether this op should be an async op Returns Async work handle, if async_op is set to True. None, if not async_op or if not part of the group
doc_27626
Alias for get_markeredgecolor.
doc_27627
Constructor for a FIFO queue. maxsize is an integer that sets the upperbound limit on the number of items that can be placed in the queue. Insertion will block once this size has been reached, until queue items are consumed. If maxsize is less than or equal to zero, the queue size is infinite.
doc_27628
operator.__concat__(a, b) Return a + b for a and b sequences.
doc_27629
Load cookies from a file. Old cookies are kept unless overwritten by newly loaded ones. Arguments are as for save(). The named file must be in the format understood by the class, or LoadError will be raised. Also, OSError may be raised, for example if the file does not exist. Changed in version 3.3: IOError used to be raised, it is now an alias of OSError.
doc_27630
Return the turtle’s current heading (value depends on the turtle mode, see mode()). >>> turtle.home() >>> turtle.left(67) >>> turtle.heading() 67.0
doc_27631
In-place version of reciprocal()
doc_27632
setDaemon() Old getter/setter API for daemon; use it directly as a property instead.
doc_27633
Length of one array element in bytes. Examples >>> x = np.array([1,2,3], dtype=np.float64) >>> x.itemsize 8 >>> x = np.array([1,2,3], dtype=np.complex128) >>> x.itemsize 16
doc_27634
Groupby iterator. Returns Generator yielding sequence of (name, subsetted object) for each group
doc_27635
Sort an array in-place. Refer to numpy.sort for full documentation. Parameters axisint, optional Axis along which to sort. Default is -1, which means sort along the last axis. kind{‘quicksort’, ‘mergesort’, ‘heapsort’, ‘stable’}, optional Sorting algorithm. The default is ‘quicksort’. Note that both ‘stable’ and ‘mergesort’ use timsort under the covers and, in general, the actual implementation will vary with datatype. The ‘mergesort’ option is retained for backwards compatibility. Changed in version 1.15.0: The ‘stable’ option was added. orderstr or list of str, optional When a is an array with fields defined, this argument specifies which fields to compare first, second, etc. A single field can be specified as a string, and not all fields need be specified, but unspecified fields will still be used, in the order in which they come up in the dtype, to break ties. See also numpy.sort Return a sorted copy of an array. numpy.argsort Indirect sort. numpy.lexsort Indirect stable sort on multiple keys. numpy.searchsorted Find elements in sorted array. numpy.partition Partial sort. Notes See numpy.sort for notes on the different sorting algorithms. Examples >>> a = np.array([[1,4], [3,1]]) >>> a.sort(axis=1) >>> a array([[1, 4], [1, 3]]) >>> a.sort(axis=0) >>> a array([[1, 3], [1, 4]]) Use the order keyword to specify a field to use when sorting a structured array: >>> a = np.array([('a', 2), ('c', 1)], dtype=[('x', 'S1'), ('y', int)]) >>> a.sort(order='y') >>> a array([(b'c', 1), (b'a', 2)], dtype=[('x', 'S1'), ('y', '<i8')])
doc_27636
The full name of a template to use as defined by a string. Not defining a template_name will raise a django.core.exceptions.ImproperlyConfigured exception.
doc_27637
Fit to data, then transform it. Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X. Parameters Xarray-like of shape (n_samples, n_features) Input samples. yarray-like of shape (n_samples,) or (n_samples, n_outputs), default=None Target values (None for unsupervised transformations). **fit_paramsdict Additional fit parameters. Returns X_newndarray array of shape (n_samples, n_features_new) Transformed array.
doc_27638
This is a variant of torch.quantile() that “ignores” NaN values, computing the quantiles q as if NaN values in input did not exist. If all values in a reduced row are NaN then the quantiles for that reduction will be NaN. See the documentation for torch.quantile(). Parameters input (Tensor) – the input tensor. q (float or Tensor) – a scalar or 1D tensor of quantile values in the range [0, 1] dim (int) – the dimension to reduce. keepdim (bool) – whether the output tensor has dim retained or not. Keyword Arguments out (Tensor, optional) – the output tensor. Example: >>> t = torch.tensor([float('nan'), 1, 2]) >>> t.quantile(0.5) tensor(nan) >>> t.nanquantile(0.5) tensor(1.5000) >>> t = torch.tensor([[float('nan'), float('nan')], [1, 2]]) >>> t tensor([[nan, nan], [1., 2.]]) >>> t.nanquantile(0.5, dim=0) tensor([1., 2.]) >>> t.nanquantile(0.5, dim=1) tensor([ nan, 1.5000])
doc_27639
Bases: matplotlib.scale.ScaleBase Provide an arbitrary scale with user-supplied function for the axis. Parameters axisAxis The axis for the scale. functions(callable, callable) two-tuple of the forward and inverse functions for the scale. The forward function must be monotonic. Both functions must have the signature: def forward(values: array-like) -> array-like get_transform()[source] Return the FuncTransform associated with this scale. name='function' set_default_locators_and_formatters(axis)[source] Set the locators and formatters of axis to instances suitable for this scale. classmatplotlib.scale.FuncScaleLog(axis, functions, base=10)[source] Bases: matplotlib.scale.LogScale Provide an arbitrary scale with user-supplied function for the axis and then put on a logarithmic axes. Parameters axismatplotlib.axis.Axis The axis for the scale. functions(callable, callable) two-tuple of the forward and inverse functions for the scale. The forward function must be monotonic. Both functions must have the signature: def forward(values: array-like) -> array-like basefloat, default: 10 Logarithmic base of the scale. propertybase get_transform()[source] Return the Transform associated with this scale. name='functionlog' classmatplotlib.scale.FuncTransform(forward, inverse)[source] Bases: matplotlib.transforms.Transform A simple transform that takes and arbitrary function for the forward and inverse transform. Parameters forwardcallable The forward function for the transform. This function must have an inverse and, for best behavior, be monotonic. It must have the signature: def forward(values: array-like) -> array-like inversecallable The inverse of the forward function. Signature as forward. has_inverse=True True if this transform has a corresponding inverse transform. input_dims=1 The number of input dimensions of this transform. Must be overridden (with integers) in the subclass. inverted()[source] Return the corresponding inverse transformation. It holds x == self.inverted().transform(self.transform(x)). The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy. is_separable=True True if this transform is separable in the x- and y- dimensions. output_dims=1 The number of output dimensions of this transform. Must be overridden (with integers) in the subclass. transform_non_affine(values)[source] Apply only the non-affine part of this transformation. transform(values) is always equivalent to transform_affine(transform_non_affine(values)). In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is always a no-op. Parameters valuesarray The input values as NumPy array of length input_dims or shape (N x input_dims). Returns array The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input. classmatplotlib.scale.InvertedLogTransform(base)[source] Bases: matplotlib.transforms.Transform Parameters shorthand_namestr A string representing the "name" of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True. has_inverse=True True if this transform has a corresponding inverse transform. input_dims=1 The number of input dimensions of this transform. Must be overridden (with integers) in the subclass. inverted()[source] Return the corresponding inverse transformation. It holds x == self.inverted().transform(self.transform(x)). The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy. is_separable=True True if this transform is separable in the x- and y- dimensions. output_dims=1 The number of output dimensions of this transform. Must be overridden (with integers) in the subclass. transform_non_affine(a)[source] Apply only the non-affine part of this transformation. transform(values) is always equivalent to transform_affine(transform_non_affine(values)). In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is always a no-op. Parameters valuesarray The input values as NumPy array of length input_dims or shape (N x input_dims). Returns array The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input. classmatplotlib.scale.InvertedSymmetricalLogTransform(base, linthresh, linscale)[source] Bases: matplotlib.transforms.Transform Parameters shorthand_namestr A string representing the "name" of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True. has_inverse=True True if this transform has a corresponding inverse transform. input_dims=1 The number of input dimensions of this transform. Must be overridden (with integers) in the subclass. inverted()[source] Return the corresponding inverse transformation. It holds x == self.inverted().transform(self.transform(x)). The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy. is_separable=True True if this transform is separable in the x- and y- dimensions. output_dims=1 The number of output dimensions of this transform. Must be overridden (with integers) in the subclass. transform_non_affine(a)[source] Apply only the non-affine part of this transformation. transform(values) is always equivalent to transform_affine(transform_non_affine(values)). In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is always a no-op. Parameters valuesarray The input values as NumPy array of length input_dims or shape (N x input_dims). Returns array The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input. classmatplotlib.scale.LinearScale(axis)[source] Bases: matplotlib.scale.ScaleBase The default linear scale. get_transform()[source] Return the transform for linear scaling, which is just the IdentityTransform. name='linear' set_default_locators_and_formatters(axis)[source] Set the locators and formatters of axis to instances suitable for this scale. classmatplotlib.scale.LogScale(axis, *, base=10, subs=None, nonpositive='clip')[source] Bases: matplotlib.scale.ScaleBase A standard logarithmic scale. Care is taken to only plot positive values. Parameters axisAxis The axis for the scale. basefloat, default: 10 The base of the logarithm. nonpositive{'clip', 'mask'}, default: 'clip' Determines the behavior for non-positive values. They can either be masked as invalid, or clipped to a very small positive number. subssequence of int, default: None Where to place the subticks between each major tick. For example, in a log10 scale, [2, 3, 4, 5, 6, 7, 8, 9] will place 8 logarithmically spaced minor ticks between each major tick. propertybase get_transform()[source] Return the LogTransform associated with this scale. limit_range_for_scale(vmin, vmax, minpos)[source] Limit the domain to positive values. name='log' set_default_locators_and_formatters(axis)[source] Set the locators and formatters of axis to instances suitable for this scale. classmatplotlib.scale.LogTransform(base, nonpositive='clip')[source] Bases: matplotlib.transforms.Transform Parameters shorthand_namestr A string representing the "name" of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True. has_inverse=True True if this transform has a corresponding inverse transform. input_dims=1 The number of input dimensions of this transform. Must be overridden (with integers) in the subclass. inverted()[source] Return the corresponding inverse transformation. It holds x == self.inverted().transform(self.transform(x)). The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy. is_separable=True True if this transform is separable in the x- and y- dimensions. output_dims=1 The number of output dimensions of this transform. Must be overridden (with integers) in the subclass. transform_non_affine(a)[source] Apply only the non-affine part of this transformation. transform(values) is always equivalent to transform_affine(transform_non_affine(values)). In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is always a no-op. Parameters valuesarray The input values as NumPy array of length input_dims or shape (N x input_dims). Returns array The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input. classmatplotlib.scale.LogisticTransform(nonpositive='mask')[source] Bases: matplotlib.transforms.Transform Parameters shorthand_namestr A string representing the "name" of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True. has_inverse=True True if this transform has a corresponding inverse transform. input_dims=1 The number of input dimensions of this transform. Must be overridden (with integers) in the subclass. inverted()[source] Return the corresponding inverse transformation. It holds x == self.inverted().transform(self.transform(x)). The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy. is_separable=True True if this transform is separable in the x- and y- dimensions. output_dims=1 The number of output dimensions of this transform. Must be overridden (with integers) in the subclass. transform_non_affine(a)[source] logistic transform (base 10) classmatplotlib.scale.LogitScale(axis, nonpositive='mask', *, one_half='\x0crac{1}{2}', use_overline=False)[source] Bases: matplotlib.scale.ScaleBase Logit scale for data between zero and one, both excluded. This scale is similar to a log scale close to zero and to one, and almost linear around 0.5. It maps the interval ]0, 1[ onto ]-infty, +infty[. Parameters axismatplotlib.axis.Axis Currently unused. nonpositive{'mask', 'clip'} Determines the behavior for values beyond the open interval ]0, 1[. They can either be masked as invalid, or clipped to a number very close to 0 or 1. use_overlinebool, default: False Indicate the usage of survival notation (overline{x}) in place of standard notation (1-x) for probability close to one. one_halfstr, default: r"frac{1}{2}" The string used for ticks formatter to represent 1/2. get_transform()[source] Return the LogitTransform associated with this scale. limit_range_for_scale(vmin, vmax, minpos)[source] Limit the domain to values between 0 and 1 (excluded). name='logit' set_default_locators_and_formatters(axis)[source] Set the locators and formatters of axis to instances suitable for this scale. classmatplotlib.scale.LogitTransform(nonpositive='mask')[source] Bases: matplotlib.transforms.Transform Parameters shorthand_namestr A string representing the "name" of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True. has_inverse=True True if this transform has a corresponding inverse transform. input_dims=1 The number of input dimensions of this transform. Must be overridden (with integers) in the subclass. inverted()[source] Return the corresponding inverse transformation. It holds x == self.inverted().transform(self.transform(x)). The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy. is_separable=True True if this transform is separable in the x- and y- dimensions. output_dims=1 The number of output dimensions of this transform. Must be overridden (with integers) in the subclass. transform_non_affine(a)[source] logit transform (base 10), masked or clipped classmatplotlib.scale.ScaleBase(axis)[source] Bases: object The base class for all scales. Scales are separable transformations, working on a single dimension. Subclasses should override name The scale's name. get_transform() A method returning a Transform, which converts data coordinates to scaled coordinates. This transform should be invertible, so that e.g. mouse positions can be converted back to data coordinates. set_default_locators_and_formatters() A method that sets default locators and formatters for an Axis that uses this scale. limit_range_for_scale() An optional method that "fixes" the axis range to acceptable values, e.g. restricting log-scaled axes to positive values. Construct a new scale. Notes The following note is for scale implementors. For back-compatibility reasons, scales take an Axis object as first argument. However, this argument should not be used: a single scale object should be usable by multiple Axises at the same time. get_transform()[source] Return the Transform object associated with this scale. limit_range_for_scale(vmin, vmax, minpos)[source] Return the range vmin, vmax, restricted to the domain supported by this scale (if any). minpos should be the minimum positive value in the data. This is used by log scales to determine a minimum value. set_default_locators_and_formatters(axis)[source] Set the locators and formatters of axis to instances suitable for this scale. classmatplotlib.scale.SymmetricalLogScale(axis, *, base=10, linthresh=2, subs=None, linscale=1)[source] Bases: matplotlib.scale.ScaleBase The symmetrical logarithmic scale is logarithmic in both the positive and negative directions from the origin. Since the values close to zero tend toward infinity, there is a need to have a range around zero that is linear. The parameter linthresh allows the user to specify the size of this range (-linthresh, linthresh). Parameters basefloat, default: 10 The base of the logarithm. linthreshfloat, default: 2 Defines the range (-x, x), within which the plot is linear. This avoids having the plot go to infinity around zero. subssequence of int Where to place the subticks between each major tick. For example, in a log10 scale: [2, 3, 4, 5, 6, 7, 8, 9] will place 8 logarithmically spaced minor ticks between each major tick. linscalefloat, optional This allows the linear range (-linthresh, linthresh) to be stretched relative to the logarithmic range. Its value is the number of decades to use for each half of the linear range. For example, when linscale == 1.0 (the default), the space used for the positive and negative halves of the linear range will be equal to one decade in the logarithmic range. Construct a new scale. Notes The following note is for scale implementors. For back-compatibility reasons, scales take an Axis object as first argument. However, this argument should not be used: a single scale object should be usable by multiple Axises at the same time. propertybase get_transform()[source] Return the SymmetricalLogTransform associated with this scale. propertylinscale propertylinthresh name='symlog' set_default_locators_and_formatters(axis)[source] Set the locators and formatters of axis to instances suitable for this scale. classmatplotlib.scale.SymmetricalLogTransform(base, linthresh, linscale)[source] Bases: matplotlib.transforms.Transform Parameters shorthand_namestr A string representing the "name" of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True. has_inverse=True True if this transform has a corresponding inverse transform. input_dims=1 The number of input dimensions of this transform. Must be overridden (with integers) in the subclass. inverted()[source] Return the corresponding inverse transformation. It holds x == self.inverted().transform(self.transform(x)). The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy. is_separable=True True if this transform is separable in the x- and y- dimensions. output_dims=1 The number of output dimensions of this transform. Must be overridden (with integers) in the subclass. transform_non_affine(a)[source] Apply only the non-affine part of this transformation. transform(values) is always equivalent to transform_affine(transform_non_affine(values)). In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is always a no-op. Parameters valuesarray The input values as NumPy array of length input_dims or shape (N x input_dims). Returns array The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input. matplotlib.scale.get_scale_names()[source] Return the names of the available scales. matplotlib.scale.register_scale(scale_class)[source] Register a new kind of scale. Parameters scale_classsubclass of ScaleBase The scale to register. matplotlib.scale.scale_factory(scale, axis, **kwargs)[source] Return a scale class by name. Parameters scale{'function', 'functionlog', 'linear', 'log', 'logit', 'symlog'} axismatplotlib.axis.Axis
doc_27640
The get_queryset method on a ModelAdmin returns a QuerySet of all model instances that can be edited by the admin site. One use case for overriding this method is to show objects owned by the logged-in user: class MyModelAdmin(admin.ModelAdmin): def get_queryset(self, request): qs = super().get_queryset(request) if request.user.is_superuser: return qs return qs.filter(author=request.user)
doc_27641
See torch.argsort()
doc_27642
Convert samples in the audio fragment to u-LAW encoding and return this as a bytes object. u-LAW is an audio encoding format whereby you get a dynamic range of about 14 bits using only 8 bit samples. It is used by the Sun audio hardware, among others.
doc_27643
This function imports and returns a fresh copy of the named Python module by removing the named module from sys.modules before doing the import. Note that unlike reload(), the original module is not affected by this operation. fresh is an iterable of additional module names that are also removed from the sys.modules cache before doing the import. blocked is an iterable of module names that are replaced with None in the module cache during the import to ensure that attempts to import them raise ImportError. The named module and any modules named in the fresh and blocked parameters are saved before starting the import and then reinserted into sys.modules when the fresh import is complete. Module and package deprecation messages are suppressed during this import if deprecated is True. This function will raise ImportError if the named module cannot be imported. Example use: # Get copies of the warnings module for testing without affecting the # version being used by the rest of the test suite. One copy uses the # C implementation, the other is forced to use the pure Python fallback # implementation py_warnings = import_fresh_module('warnings', blocked=['_warnings']) c_warnings = import_fresh_module('warnings', fresh=['_warnings']) New in version 3.1.
doc_27644
os.O_NOINHERIT os.O_SHORT_LIVED os.O_TEMPORARY os.O_RANDOM os.O_SEQUENTIAL os.O_TEXT The above constants are only available on Windows.
doc_27645
Compute elastic net path with coordinate descent. The elastic net optimization function varies for mono and multi-outputs. For mono-output tasks it is: 1 / (2 * n_samples) * ||y - Xw||^2_2 + alpha * l1_ratio * ||w||_1 + 0.5 * alpha * (1 - l1_ratio) * ||w||^2_2 For multi-output tasks it is: (1 / (2 * n_samples)) * ||Y - XW||^Fro_2 + alpha * l1_ratio * ||W||_21 + 0.5 * alpha * (1 - l1_ratio) * ||W||_Fro^2 Where: ||W||_21 = \sum_i \sqrt{\sum_j w_{ij}^2} i.e. the sum of norm of each row. Read more in the User Guide. Parameters X{array-like, sparse matrix} of shape (n_samples, n_features) Training data. Pass directly as Fortran-contiguous data to avoid unnecessary memory duplication. If y is mono-output then X can be sparse. y{array-like, sparse matrix} of shape (n_samples,) or (n_samples, n_outputs) Target values. l1_ratiofloat, default=0.5 Number between 0 and 1 passed to elastic net (scaling between l1 and l2 penalties). l1_ratio=1 corresponds to the Lasso. epsfloat, default=1e-3 Length of the path. eps=1e-3 means that alpha_min / alpha_max = 1e-3. n_alphasint, default=100 Number of alphas along the regularization path. alphasndarray, default=None List of alphas where to compute the models. If None alphas are set automatically. precompute‘auto’, bool or array-like of shape (n_features, n_features), default=’auto’ Whether to use a precomputed Gram matrix to speed up calculations. If set to 'auto' let us decide. The Gram matrix can also be passed as argument. Xyarray-like of shape (n_features,) or (n_features, n_outputs), default=None Xy = np.dot(X.T, y) that can be precomputed. It is useful only when the Gram matrix is precomputed. copy_Xbool, default=True If True, X will be copied; else, it may be overwritten. coef_initndarray of shape (n_features, ), default=None The initial values of the coefficients. verbosebool or int, default=False Amount of verbosity. return_n_iterbool, default=False Whether to return the number of iterations or not. positivebool, default=False If set to True, forces coefficients to be positive. (Only allowed when y.ndim == 1). check_inputbool, default=True If set to False, the input validation checks are skipped (including the Gram matrix when provided). It is assumed that they are handled by the caller. **paramskwargs Keyword arguments passed to the coordinate descent solver. Returns alphasndarray of shape (n_alphas,) The alphas along the path where models are computed. coefsndarray of shape (n_features, n_alphas) or (n_outputs, n_features, n_alphas) Coefficients along the path. dual_gapsndarray of shape (n_alphas,) The dual gaps at the end of the optimization for each alpha. n_iterslist of int The number of iterations taken by the coordinate descent optimizer to reach the specified tolerance for each alpha. (Is returned when return_n_iter is set to True). See also MultiTaskElasticNet MultiTaskElasticNetCV ElasticNet ElasticNetCV Notes For an example, see examples/linear_model/plot_lasso_coordinate_descent_path.py.
doc_27646
Return True for ignorable lines. The line line is ignorable if line is blank or contains a single '#', otherwise it is not ignorable. Used as a default for parameter linejunk in ndiff() in older versions.
doc_27647
See Migration guide for more details. tf.compat.v1.errors.UnavailableError tf.errors.UnavailableError( node_def, op, message ) This exception is not currently used. Attributes error_code The integer error code that describes the error. message The error message that describes the error. node_def The NodeDef proto representing the op that failed. op The operation that failed, if known. Note: If the failed op was synthesized at runtime, e.g. a Send or Recv op, there will be no corresponding tf.Operation object. In that case, this will return None, and you should instead use the tf.errors.OpError.node_def to discover information about the op.
doc_27648
The HTTP status code for the response. Unless reason_phrase is explicitly set, modifying the value of status_code outside the constructor will also modify the value of reason_phrase.
doc_27649
assertGreaterEqual(first, second, msg=None) assertLess(first, second, msg=None) assertLessEqual(first, second, msg=None) Test that first is respectively >, >=, < or <= than second depending on the method name. If not, the test will fail: >>> self.assertGreaterEqual(3, 4) AssertionError: "3" unexpectedly not greater than or equal to "4" New in version 3.1.
doc_27650
Pseudo-Vandermonde matrix of given degree. Returns the pseudo-Vandermonde matrix of degree deg and sample points x. The pseudo-Vandermonde matrix is defined by \[V[..., i] = He_i(x),\] where 0 <= i <= deg. The leading indices of V index the elements of x and the last index is the degree of the HermiteE polynomial. If c is a 1-D array of coefficients of length n + 1 and V is the array V = hermevander(x, n), then np.dot(V, c) and hermeval(x, c) are the same up to roundoff. This equivalence is useful both for least squares fitting and for the evaluation of a large number of HermiteE series of the same degree and sample points. Parameters xarray_like Array of points. The dtype is converted to float64 or complex128 depending on whether any of the elements are complex. If x is scalar it is converted to a 1-D array. degint Degree of the resulting matrix. Returns vanderndarray The pseudo-Vandermonde matrix. The shape of the returned matrix is x.shape + (deg + 1,), where The last index is the degree of the corresponding HermiteE polynomial. The dtype will be the same as the converted x. Examples >>> from numpy.polynomial.hermite_e import hermevander >>> x = np.array([-1, 0, 1]) >>> hermevander(x, 3) array([[ 1., -1., 0., 2.], [ 1., 0., -1., -0.], [ 1., 1., 0., -2.]])
doc_27651
Returns the smallest representable number larger than x.
doc_27652
Generates a string representation of an XML element, including all subelements. element is an Element instance. encoding 1 is the output encoding (default is US-ASCII). Use encoding="unicode" to generate a Unicode string (otherwise, a bytestring is generated). method is either "xml", "html" or "text" (default is "xml"). xml_declaration, default_namespace and short_empty_elements has the same meaning as in ElementTree.write(). Returns an (optionally) encoded string containing the XML data. New in version 3.4: The short_empty_elements parameter. New in version 3.8: The xml_declaration and default_namespace parameters. Changed in version 3.8: The tostring() function now preserves the attribute order specified by the user.
doc_27653
Selects TLS version 1.1 as the channel encryption protocol. Available only with openssl version 1.0.1+. New in version 3.4. Deprecated since version 3.6: OpenSSL has deprecated all version specific protocols. Use the default protocol PROTOCOL_TLS with flags like OP_NO_SSLv3 instead.
doc_27654
class fractions.Fraction(numerator=0, denominator=1) class fractions.Fraction(other_fraction) class fractions.Fraction(float) class fractions.Fraction(decimal) class fractions.Fraction(string) The first version requires that numerator and denominator are instances of numbers.Rational and returns a new Fraction instance with value numerator/denominator. If denominator is 0, it raises a ZeroDivisionError. The second version requires that other_fraction is an instance of numbers.Rational and returns a Fraction instance with the same value. The next two versions accept either a float or a decimal.Decimal instance, and return a Fraction instance with exactly the same value. Note that due to the usual issues with binary floating-point (see Floating Point Arithmetic: Issues and Limitations), the argument to Fraction(1.1) is not exactly equal to 11/10, and so Fraction(1.1) does not return Fraction(11, 10) as one might expect. (But see the documentation for the limit_denominator() method below.) The last version of the constructor expects a string or unicode instance. The usual form for this instance is: [sign] numerator ['/' denominator] where the optional sign may be either ‘+’ or ‘-‘ and numerator and denominator (if present) are strings of decimal digits. In addition, any string that represents a finite value and is accepted by the float constructor is also accepted by the Fraction constructor. In either form the input string may also have leading and/or trailing whitespace. Here are some examples: >>> from fractions import Fraction >>> Fraction(16, -10) Fraction(-8, 5) >>> Fraction(123) Fraction(123, 1) >>> Fraction() Fraction(0, 1) >>> Fraction('3/7') Fraction(3, 7) >>> Fraction(' -3/7 ') Fraction(-3, 7) >>> Fraction('1.414213 \t\n') Fraction(1414213, 1000000) >>> Fraction('-.125') Fraction(-1, 8) >>> Fraction('7e-6') Fraction(7, 1000000) >>> Fraction(2.25) Fraction(9, 4) >>> Fraction(1.1) Fraction(2476979795053773, 2251799813685248) >>> from decimal import Decimal >>> Fraction(Decimal('1.1')) Fraction(11, 10) The Fraction class inherits from the abstract base class numbers.Rational, and implements all of the methods and operations from that class. Fraction instances are hashable, and should be treated as immutable. In addition, Fraction has the following properties and methods: Changed in version 3.2: The Fraction constructor now accepts float and decimal.Decimal instances. Changed in version 3.9: The math.gcd() function is now used to normalize the numerator and denominator. math.gcd() always return a int type. Previously, the GCD type depended on numerator and denominator. numerator Numerator of the Fraction in lowest term. denominator Denominator of the Fraction in lowest term. as_integer_ratio() Return a tuple of two integers, whose ratio is equal to the Fraction and with a positive denominator. New in version 3.8. from_float(flt) This class method constructs a Fraction representing the exact value of flt, which must be a float. Beware that Fraction.from_float(0.3) is not the same value as Fraction(3, 10). Note From Python 3.2 onwards, you can also construct a Fraction instance directly from a float. from_decimal(dec) This class method constructs a Fraction representing the exact value of dec, which must be a decimal.Decimal instance. Note From Python 3.2 onwards, you can also construct a Fraction instance directly from a decimal.Decimal instance. limit_denominator(max_denominator=1000000) Finds and returns the closest Fraction to self that has denominator at most max_denominator. This method is useful for finding rational approximations to a given floating-point number: >>> from fractions import Fraction >>> Fraction('3.1415926535897932').limit_denominator(1000) Fraction(355, 113) or for recovering a rational number that’s represented as a float: >>> from math import pi, cos >>> Fraction(cos(pi/3)) Fraction(4503599627370497, 9007199254740992) >>> Fraction(cos(pi/3)).limit_denominator() Fraction(1, 2) >>> Fraction(1.1).limit_denominator() Fraction(11, 10) __floor__() Returns the greatest int <= self. This method can also be accessed through the math.floor() function: >>> from math import floor >>> floor(Fraction(355, 113)) 3 __ceil__() Returns the least int >= self. This method can also be accessed through the math.ceil() function. __round__() __round__(ndigits) The first version returns the nearest int to self, rounding half to even. The second version rounds self to the nearest multiple of Fraction(1, 10**ndigits) (logically, if ndigits is negative), again rounding half toward even. This method can also be accessed through the round() function. See also Module numbers The abstract base classes making up the numeric tower.
doc_27655
Predict classes for X. Parameters Xarray-like, shape (n_samples, n_features) The input samples. Returns yndarray, shape (n_samples,) The predicted classes.
doc_27656
Called when the other end signals it won’t send any more data (for example by calling transport.write_eof(), if the other end also uses asyncio). This method may return a false value (including None), in which case the transport will close itself. Conversely, if this method returns a true value, the protocol used determines whether to close the transport. Since the default implementation returns None, it implicitly closes the connection. Some transports, including SSL, don’t support half-closed connections, in which case returning true from this method will result in the connection being closed.
doc_27657
Test element-wise for positive infinity, return result as bool array. Parameters xarray_like The input array. outarray_like, optional A location into which the result is stored. If provided, it must have a shape that the input broadcasts to. If not provided or None, a freshly-allocated boolean array is returned. Returns outndarray A boolean array with the same dimensions as the input. If second argument is not supplied then a boolean array is returned with values True where the corresponding element of the input is positive infinity and values False where the element of the input is not positive infinity. If a second argument is supplied the result is stored there. If the type of that array is a numeric type the result is represented as zeros and ones, if the type is boolean then as False and True. The return value out is then a reference to that array. See also isinf, isneginf, isfinite, isnan Notes NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic (IEEE 754). Errors result if the second argument is also supplied when x is a scalar input, if first and second arguments have different shapes, or if the first argument has complex values Examples >>> np.isposinf(np.PINF) True >>> np.isposinf(np.inf) True >>> np.isposinf(np.NINF) False >>> np.isposinf([-np.inf, 0., np.inf]) array([False, False, True]) >>> x = np.array([-np.inf, 0., np.inf]) >>> y = np.array([2, 2, 2]) >>> np.isposinf(x, y) array([0, 0, 1]) >>> y array([0, 0, 1])
doc_27658
See Migration guide for more details. tf.compat.v1.raw_ops.Acos tf.raw_ops.Acos( x, name=None ) Provided an input tensor, the tf.math.acos operation returns the inverse cosine of each element of the tensor. If y = tf.math.cos(x) then, x = tf.math.acos(y). Input range is [-1, 1] and the output has a range of [0, pi]. Args x A Tensor. Must be one of the following types: bfloat16, half, float32, float64, int8, int16, int32, int64, complex64, complex128. name A name for the operation (optional). Returns A Tensor. Has the same type as x.
doc_27659
The namespace URI associated with the reserved prefix xml, as defined by Namespaces in XML (section 4).
doc_27660
Return the next random floating point number in the range [0.0, 1.0).
doc_27661
Center and scale the data. Parameters X{array-like, sparse matrix} of shape (n_samples, n_features) The data used to scale along the specified axis. Returns X_tr{ndarray, sparse matrix} of shape (n_samples, n_features) Transformed array.
doc_27662
sklearn.utils.indexable(*iterables) [source] Make arrays indexable for cross-validation. Checks consistent length, passes through None, and ensures that everything can be indexed by converting sparse matrices to csr and converting non-interable objects to arrays. Parameters *iterables{lists, dataframes, ndarrays, sparse matrices} List of objects to ensure sliceability.
doc_27663
class sklearn.impute.MissingIndicator(*, missing_values=nan, features='missing-only', sparse='auto', error_on_new=True) [source] Binary indicators for missing values. Note that this component typically should not be used in a vanilla Pipeline consisting of transformers and a classifier, but rather could be added using a FeatureUnion or ColumnTransformer. Read more in the User Guide. New in version 0.20. Parameters missing_valuesint, float, string, np.nan or None, default=np.nan The placeholder for the missing values. All occurrences of missing_values will be imputed. For pandas’ dataframes with nullable integer dtypes with missing values, missing_values should be set to np.nan, since pd.NA will be converted to np.nan. features{‘missing-only’, ‘all’}, default=’missing-only’ Whether the imputer mask should represent all or a subset of features. If ‘missing-only’ (default), the imputer mask will only represent features containing missing values during fit time. If ‘all’, the imputer mask will represent all features. sparsebool or ‘auto’, default=’auto’ Whether the imputer mask format should be sparse or dense. If ‘auto’ (default), the imputer mask will be of same type as input. If True, the imputer mask will be a sparse matrix. If False, the imputer mask will be a numpy array. error_on_newbool, default=True If True, transform will raise an error when there are features with missing values in transform that have no missing values in fit. This is applicable only when features='missing-only'. Attributes features_ndarray, shape (n_missing_features,) or (n_features,) The features indices which will be returned when calling transform. They are computed during fit. For features='all', it is to range(n_features). Examples >>> import numpy as np >>> from sklearn.impute import MissingIndicator >>> X1 = np.array([[np.nan, 1, 3], ... [4, 0, np.nan], ... [8, 1, 0]]) >>> X2 = np.array([[5, 1, np.nan], ... [np.nan, 2, 3], ... [2, 4, 0]]) >>> indicator = MissingIndicator() >>> indicator.fit(X1) MissingIndicator() >>> X2_tr = indicator.transform(X2) >>> X2_tr array([[False, True], [ True, False], [False, False]]) Methods fit(X[, y]) Fit the transformer on X. fit_transform(X[, y]) Generate missing values indicator for X. get_params([deep]) Get parameters for this estimator. set_params(**params) Set the parameters of this estimator. transform(X) Generate missing values indicator for X. fit(X, y=None) [source] Fit the transformer on X. Parameters X{array-like, sparse matrix}, shape (n_samples, n_features) Input data, where n_samples is the number of samples and n_features is the number of features. Returns selfobject Returns self. fit_transform(X, y=None) [source] Generate missing values indicator for X. Parameters X{array-like, sparse matrix}, shape (n_samples, n_features) The input data to complete. Returns Xt{ndarray or sparse matrix}, shape (n_samples, n_features) or (n_samples, n_features_with_missing) The missing indicator for input data. The data type of Xt will be boolean. get_params(deep=True) [source] Get parameters for this estimator. Parameters deepbool, default=True If True, will return the parameters for this estimator and contained subobjects that are estimators. Returns paramsdict Parameter names mapped to their values. set_params(**params) [source] Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object. Parameters **paramsdict Estimator parameters. Returns selfestimator instance Estimator instance. transform(X) [source] Generate missing values indicator for X. Parameters X{array-like, sparse matrix}, shape (n_samples, n_features) The input data to complete. Returns Xt{ndarray or sparse matrix}, shape (n_samples, n_features) or (n_samples, n_features_with_missing) The missing indicator for input data. The data type of Xt will be boolean.
doc_27664
returns an unmodified image as a string get_raw() -> string Gets an image from a camera as a string in the native pixelformat of the camera. Useful for integration with other libraries.
doc_27665
Read an image from a file into an array. Note This function exists for historical reasons. It is recommended to use PIL.Image.open instead for loading images. Parameters fnamestr or file-like The image file to read: a filename, a URL or a file-like object opened in read-binary mode. Passing a URL is deprecated. Please open the URL for reading and pass the result to Pillow, e.g. with np.array(PIL.Image.open(urllib.request.urlopen(url))). formatstr, optional The image file format assumed for reading the data. The image is loaded as a PNG file if format is set to "png", if fname is a path or opened file with a ".png" extension, or if it is an URL. In all other cases, format is ignored and the format is auto-detected by PIL.Image.open. Returns numpy.array The image data. The returned array has shape (M, N) for grayscale images. (M, N, 3) for RGB images. (M, N, 4) for RGBA images. PNG images are returned as float arrays (0-1). All other formats are returned as int arrays, with a bit depth determined by the file's contents. Examples using matplotlib.pyplot.imread Clipping images with patches Image Demo AnnotationBbox demo Using a text as a Path Convert texts to images Ribbon Box
doc_27666
Base class for exceptions raised when problems occur performing string interpolation.
doc_27667
Plot the sparsity pattern of a 2D array. This visualizes the non-zero values of the array. Two plotting styles are available: image and marker. Both are available for full arrays, but only the marker style works for scipy.sparse.spmatrix instances. Image style If marker and markersize are None, imshow is used. Any extra remaining keyword arguments are passed to this method. Marker style If Z is a scipy.sparse.spmatrix or marker or markersize are None, a Line2D object will be returned with the value of marker determining the marker type, and any remaining keyword arguments passed to plot. Parameters Z(M, N) array-like The array to be plotted. precisionfloat or 'present', default: 0 If precision is 0, any non-zero value will be plotted. Otherwise, values of \(|Z| > precision\) will be plotted. For scipy.sparse.spmatrix instances, you can also pass 'present'. In this case any value present in the array will be plotted, even if it is identically zero. aspect{'equal', 'auto', None} or float, default: 'equal' The aspect ratio of the Axes. This parameter is particularly relevant for images since it determines whether data pixels are square. This parameter is a shortcut for explicitly calling Axes.set_aspect. See there for further details. 'equal': Ensures an aspect ratio of 1. Pixels will be square. 'auto': The Axes is kept fixed and the aspect is adjusted so that the data fit in the Axes. In general, this will result in non-square pixels. None: Use rcParams["image.aspect"] (default: 'equal'). origin{'upper', 'lower'}, default: rcParams["image.origin"] (default: 'upper') Place the [0, 0] index of the array in the upper left or lower left corner of the Axes. The convention 'upper' is typically used for matrices and images. Returns AxesImage or Line2D The return type depends on the plotting style (see above). Other Parameters **kwargs The supported additional parameters depend on the plotting style. For the image style, you can pass the following additional parameters of imshow: cmap alpha url any Artist properties (passed on to the AxesImage) For the marker style, you can pass any Line2D property except for linestyle: Property Description agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array alpha scalar or None animated bool antialiased or aa bool clip_box Bbox clip_on bool clip_path Patch or (Path, Transform) or None color or c color dash_capstyle CapStyle or {'butt', 'projecting', 'round'} dash_joinstyle JoinStyle or {'miter', 'round', 'bevel'} dashes sequence of floats (on/off ink in points) or (None, None) data (2, N) array or two 1D arrays drawstyle or ds {'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default' figure Figure fillstyle {'full', 'left', 'right', 'bottom', 'top', 'none'} gid str in_layout bool label object linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...} linewidth or lw float marker marker style string, Path or MarkerStyle markeredgecolor or mec color markeredgewidth or mew float markerfacecolor or mfc color markerfacecoloralt or mfcalt color markersize or ms float markevery None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool] path_effects AbstractPathEffect picker float or callable[[Artist, Event], tuple[bool, dict]] pickradius float rasterized bool sketch_params (scale: float, length: float, randomness: float) snap bool or None solid_capstyle CapStyle or {'butt', 'projecting', 'round'} solid_joinstyle JoinStyle or {'miter', 'round', 'bevel'} transform unknown url str visible bool xdata 1D array ydata 1D array zorder float
doc_27668
Use ghostscript's pswrite or epswrite device to distill a file. This yields smaller files without illegal encapsulated postscript operators. The output is low-level, converting text to outlines.
doc_27669
Return a new array with fields in drop_names dropped. Nested fields are supported. Changed in version 1.18.0: drop_fields returns an array with 0 fields if all fields are dropped, rather than returning None as it did previously. Parameters basearray Input array drop_namesstring or sequence String or sequence of strings corresponding to the names of the fields to drop. usemask{False, True}, optional Whether to return a masked array or not. asrecarraystring or sequence, optional Whether to return a recarray or a mrecarray (asrecarray=True) or a plain ndarray or masked array with flexible dtype. The default is False. Examples >>> from numpy.lib import recfunctions as rfn >>> a = np.array([(1, (2, 3.0)), (4, (5, 6.0))], ... dtype=[('a', np.int64), ('b', [('ba', np.double), ('bb', np.int64)])]) >>> rfn.drop_fields(a, 'a') array([((2., 3),), ((5., 6),)], dtype=[('b', [('ba', '<f8'), ('bb', '<i8')])]) >>> rfn.drop_fields(a, 'ba') array([(1, (3,)), (4, (6,))], dtype=[('a', '<i8'), ('b', [('bb', '<i8')])]) >>> rfn.drop_fields(a, ['ba', 'bb']) array([(1,), (4,)], dtype=[('a', '<i8')])
doc_27670
Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object. Parameters **paramsdict Estimator parameters. Returns selfestimator instance Estimator instance.
doc_27671
tf.data.experimental.StatsAggregator() To record statistics, use one of the custom transformation functions defined in this module when defining your tf.data.Dataset. All statistics will be aggregated by the StatsAggregator that is associated with a particular iterator (see below). For example, to record the latency of producing each element by iterating over a dataset: dataset = ... dataset = dataset.apply(tf.data.experimental.latency_stats("total_bytes")) To associate a StatsAggregator with a tf.data.Dataset object, use the following pattern: aggregator = tf.data.experimental.StatsAggregator() dataset = ... # Apply `StatsOptions` to associate `dataset` with `aggregator`. options = tf.data.Options() options.experimental_stats.aggregator = aggregator dataset = dataset.with_options(options) Note: This interface is experimental and expected to change. In particular, we expect to add other implementations of StatsAggregator that provide different ways of exporting statistics, and add more types of statistics.
doc_27672
Least squares fit to data. Return a series instance that is the least squares fit to the data y sampled at x. The domain of the returned instance can be specified and this will often result in a superior fit with less chance of ill conditioning. Parameters xarray_like, shape (M,) x-coordinates of the M sample points (x[i], y[i]). yarray_like, shape (M,) y-coordinates of the M sample points (x[i], y[i]). degint or 1-D array_like Degree(s) of the fitting polynomials. If deg is a single integer all terms up to and including the deg’th term are included in the fit. For NumPy versions >= 1.11.0 a list of integers specifying the degrees of the terms to include may be used instead. domain{None, [beg, end], []}, optional Domain to use for the returned series. If None, then a minimal domain that covers the points x is chosen. If [] the class domain is used. The default value was the class domain in NumPy 1.4 and None in later versions. The [] option was added in numpy 1.5.0. rcondfloat, optional Relative condition number of the fit. Singular values smaller than this relative to the largest singular value will be ignored. The default value is len(x)*eps, where eps is the relative precision of the float type, about 2e-16 in most cases. fullbool, optional Switch determining nature of return value. When it is False (the default) just the coefficients are returned, when True diagnostic information from the singular value decomposition is also returned. warray_like, shape (M,), optional Weights. If not None, the weight w[i] applies to the unsquared residual y[i] - y_hat[i] at x[i]. Ideally the weights are chosen so that the errors of the products w[i]*y[i] all have the same variance. When using inverse-variance weighting, use w[i] = 1/sigma(y[i]). The default value is None. New in version 1.5.0. window{[beg, end]}, optional Window to use for the returned series. The default value is the default class domain New in version 1.6.0. Returns new_seriesseries A series that represents the least squares fit to the data and has the domain and window specified in the call. If the coefficients for the unscaled and unshifted basis polynomials are of interest, do new_series.convert().coef. [resid, rank, sv, rcond]list These values are only returned if full == True resid – sum of squared residuals of the least squares fit rank – the numerical rank of the scaled Vandermonde matrix sv – singular values of the scaled Vandermonde matrix rcond – value of rcond. For more details, see linalg.lstsq.
doc_27673
Like get_full_path(), but uses path_info instead of path. Example: "/minfo/music/bands/the_beatles/?print=true"
doc_27674
See Migration guide for more details. tf.compat.v1.raw_ops.SerializeManySparse tf.raw_ops.SerializeManySparse( sparse_indices, sparse_values, sparse_shape, out_type=tf.dtypes.string, name=None ) The SparseTensor must have rank R greater than 1, and the first dimension is treated as the minibatch dimension. Elements of the SparseTensor must be sorted in increasing order of this first dimension. The serialized SparseTensor objects going into each row of serialized_sparse will have rank R-1. The minibatch size N is extracted from sparse_shape[0]. Args sparse_indices A Tensor of type int64. 2-D. The indices of the minibatch SparseTensor. sparse_values A Tensor. 1-D. The values of the minibatch SparseTensor. sparse_shape A Tensor of type int64. 1-D. The shape of the minibatch SparseTensor. out_type An optional tf.DType from: tf.string, tf.variant. Defaults to tf.string. The dtype to use for serialization; the supported types are string (default) and variant. name A name for the operation (optional). Returns A Tensor of type out_type.
doc_27675
Predict class for X. The predicted class of an input sample is a vote by the trees in the forest, weighted by their probability estimates. That is, the predicted class is the one with highest mean probability estimate across the trees. Parameters X{array-like, sparse matrix} of shape (n_samples, n_features) The input samples. Internally, its dtype will be converted to dtype=np.float32. If a sparse matrix is provided, it will be converted into a sparse csr_matrix. Returns yndarray of shape (n_samples,) or (n_samples, n_outputs) The predicted classes.
doc_27676
Return an iterator of the values. These are each a scalar type, which is a Python scalar (for str, int, float) or a pandas scalar (for Timestamp/Timedelta/Interval/Period) Returns iterator
doc_27677
Returns a mask of the overlapping set bits overlap_mask(othermask, offset) -> Mask Returns a Mask, the same size as this mask, containing the overlapping set bits between this mask and othermask. Parameters: othermask (Mask) -- the other mask to overlap with this mask offset (tuple(int, int) or list[int, int]) -- the offset of othermask from this mask, for more details refer to the Mask offset notes Returns: a newly created Mask with the overlapping bits set Return type: Mask
doc_27678
See torch.matrix_exp()
doc_27679
pygame object for color representations Color(r, g, b) -> Color Color(r, g, b, a=255) -> Color Color(color_value) -> Color The Color class represents RGBA color values using a value range of 0 to 255 inclusive. It allows basic arithmetic operations — binary operations +, -, *, //, %, and unary operation ~ — to create new colors, supports conversions to other color spaces such as HSV or HSL and lets you adjust single color channels. Alpha defaults to 255 (fully opaque) when not given. The arithmetic operations and correct_gamma() method preserve subclasses. For the binary operators, the class of the returned color is that of the left hand color object of the operator. Color objects support equality comparison with other color objects and 3 or 4 element tuples of integers. There was a bug in pygame 1.8.1 where the default alpha was 0, not 255 like previously. Color objects export the C level array interface. The interface exports a read-only one dimensional unsigned byte array of the same assigned length as the color. For CPython 2.6 and later, the new buffer interface is also exported, with the same characteristics as the array interface. The floor division, //, and modulus, %, operators do not raise an exception for division by zero. Instead, if a color, or alpha, channel in the right hand color is 0, then the result is 0. For example: # These expressions are True Color(255, 255, 255, 255) // Color(0, 64, 64, 64) == Color(0, 3, 3, 3) Color(255, 255, 255, 255) % Color(64, 64, 64, 0) == Color(63, 63, 63, 0) Parameters: r (int) -- red value in the range of 0 to 255 inclusive g (int) -- green value in the range of 0 to 255 inclusive b (int) -- blue value in the range of 0 to 255 inclusive a (int) -- (optional) alpha value in the range of 0 to 255 inclusive, default is 255 color_value (Color or str or int or tuple(int, int, int, [int]) or list(int, int, int, [int])) -- color value (see note below for the supported formats) Note Supported color_value formats: - Color object: clones the given Color object - color name str: name of the color to use, e.g. 'red' (all the supported name strings can be found in the colordict module) - HTML color format str: '#rrggbbaa' or '#rrggbb', where rr, gg, bb, and aa are 2-digit hex numbers in the range of 0 to 0xFF inclusive, the aa (alpha) value defaults to 0xFF if not provided - hex number str: '0xrrggbbaa' or '0xrrggbb', where rr, gg, bb, and aa are 2-digit hex numbers in the range of 0x00 to 0xFF inclusive, the aa (alpha) value defaults to 0xFF if not provided - int: int value of the color to use, using hex numbers can make this parameter more readable, e.g. 0xrrggbbaa, where rr, gg, bb, and aa are 2-digit hex numbers in the range of 0x00 to 0xFF inclusive, note that the aa (alpha) value is not optional for the int format and must be provided - tuple/list of int color values: (R, G, B, A) or (R, G, B), where R, G, B, and A are int values in the range of 0 to 255 inclusive, the A (alpha) value defaults to 255 if not provided Returns: a newly created Color object Return type: Color Changed in pygame 2.0.0: Support for tuples, lists, and Color objects when creating Color objects. Changed in pygame 1.9.2: Color objects export the C level array interface. Changed in pygame 1.9.0: Color objects support 4-element tuples of integers. Changed in pygame 1.8.1: New implementation of the class. r Gets or sets the red value of the Color. r -> int The red value of the Color. g Gets or sets the green value of the Color. g -> int The green value of the Color. b Gets or sets the blue value of the Color. b -> int The blue value of the Color. a Gets or sets the alpha value of the Color. a -> int The alpha value of the Color. cmy Gets or sets the CMY representation of the Color. cmy -> tuple The CMY representation of the Color. The CMY components are in the ranges C = [0, 1], M = [0, 1], Y = [0, 1]. Note that this will not return the absolutely exact CMY values for the set RGB values in all cases. Due to the RGB mapping from 0-255 and the CMY mapping from 0-1 rounding errors may cause the CMY values to differ slightly from what you might expect. hsva Gets or sets the HSVA representation of the Color. hsva -> tuple The HSVA representation of the Color. The HSVA components are in the ranges H = [0, 360], S = [0, 100], V = [0, 100], A = [0, 100]. Note that this will not return the absolutely exact HSV values for the set RGB values in all cases. Due to the RGB mapping from 0-255 and the HSV mapping from 0-100 and 0-360 rounding errors may cause the HSV values to differ slightly from what you might expect. hsla Gets or sets the HSLA representation of the Color. hsla -> tuple The HSLA representation of the Color. The HSLA components are in the ranges H = [0, 360], S = [0, 100], V = [0, 100], A = [0, 100]. Note that this will not return the absolutely exact HSL values for the set RGB values in all cases. Due to the RGB mapping from 0-255 and the HSL mapping from 0-100 and 0-360 rounding errors may cause the HSL values to differ slightly from what you might expect. i1i2i3 Gets or sets the I1I2I3 representation of the Color. i1i2i3 -> tuple The I1I2I3 representation of the Color. The I1I2I3 components are in the ranges I1 = [0, 1], I2 = [-0.5, 0.5], I3 = [-0.5, 0.5]. Note that this will not return the absolutely exact I1I2I3 values for the set RGB values in all cases. Due to the RGB mapping from 0-255 and the I1I2I3 mapping from 0-1 rounding errors may cause the I1I2I3 values to differ slightly from what you might expect. normalize() Returns the normalized RGBA values of the Color. normalize() -> tuple Returns the normalized RGBA values of the Color as floating point values. correct_gamma() Applies a certain gamma value to the Color. correct_gamma (gamma) -> Color Applies a certain gamma value to the Color and returns a new Color with the adjusted RGBA values. set_length() Set the number of elements in the Color to 1,2,3, or 4. set_length(len) -> None The default Color length is 4. Colors can have lengths 1,2,3 or 4. This is useful if you want to unpack to r,g,b and not r,g,b,a. If you want to get the length of a Color do len(acolor). New in pygame 1.9.0. lerp() returns a linear interpolation to the given Color. lerp(Color, float) -> Color Returns a Color which is a linear interpolation between self and the given Color in RGBA space. The second parameter determines how far between self and other the result is going to be. It must be a value between 0 and 1 where 0 means self and 1 means other will be returned. New in pygame 2.0.1. premul_alpha() returns a Color where the r,g,b components have been multiplied by the alpha. premul_alpha() -> Color Returns a new Color where each of the red, green and blue colour channels have been multiplied by the alpha channel of the original color. The alpha channel remains unchanged. This is useful when working with the BLEND_PREMULTIPLIED blending mode flag for pygame.Surface.blit(), which assumes that all surfaces using it are using pre-multiplied alpha colors. New in pygame 2.0.0. update() Sets the elements of the color update(r, g, b) -> None update(r, g, b, a=255) -> None update(color_value) -> None Sets the elements of the color. See parameters for pygame.Color() for the parameters of this function. If the alpha value was not set it will not change. New in pygame 2.0.1.
doc_27680
The last colorbar associated with this ScalarMappable. May be None.
doc_27681
The UpdateView page displayed to a GET request uses a template_name_suffix of '_form'. For example, changing this attribute to '_update_form' for a view updating objects for the example Author model would cause the default template_name to be 'myapp/author_update_form.html'.
doc_27682
See Migration guide for more details. tf.compat.v1.raw_ops.FFT tf.raw_ops.FFT( input, name=None ) Computes the 1-dimensional discrete Fourier transform over the inner-most dimension of input. Args input A Tensor. Must be one of the following types: complex64, complex128. A complex tensor. name A name for the operation (optional). Returns A Tensor. Has the same type as input.
doc_27683
sklearn.datasets.load_boston(*, return_X_y=False) [source] Load and return the boston house-prices dataset (regression). Samples total 506 Dimensionality 13 Features real, positive Targets real 5. - 50. Read more in the User Guide. Parameters return_X_ybool, default=False If True, returns (data, target) instead of a Bunch object. See below for more information about the data and target object. New in version 0.18. Returns dataBunch Dictionary-like object, with the following attributes. datandarray of shape (506, 13) The data matrix. targetndarray of shape (506, ) The regression target. filenamestr The physical location of boston csv dataset. New in version 0.20. DESCRstr The full description of the dataset. feature_namesndarray The names of features (data, target)tuple if return_X_y is True New in version 0.18. Notes Changed in version 0.20: Fixed a wrong data point at [445, 0]. Examples >>> from sklearn.datasets import load_boston >>> X, y = load_boston(return_X_y=True) >>> print(X.shape) (506, 13)
doc_27684
See Migration guide for more details. tf.compat.v1.raw_ops.Multinomial tf.raw_ops.Multinomial( logits, num_samples, seed=0, seed2=0, output_dtype=tf.dtypes.int64, name=None ) Args logits A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8, int64, bfloat16, uint16, half, uint32, uint64. 2-D Tensor with shape [batch_size, num_classes]. Each slice [i, :] represents the unnormalized log probabilities for all classes. num_samples A Tensor of type int32. 0-D. Number of independent samples to draw for each row slice. seed An optional int. Defaults to 0. If either seed or seed2 is set to be non-zero, the internal random number generator is seeded by the given seed. Otherwise, a random seed is used. seed2 An optional int. Defaults to 0. A second seed to avoid seed collision. output_dtype An optional tf.DType from: tf.int32, tf.int64. Defaults to tf.int64. name A name for the operation (optional). Returns A Tensor of type output_dtype.
doc_27685
The method writes a list (or any iterable) of bytes to the underlying socket immediately. If that fails, the data is queued in an internal write buffer until it can be sent. The method should be used along with the drain() method: stream.writelines(lines) await stream.drain()
doc_27686
Returns True if the given raw string is the correct password for the user. (This takes care of the password hashing in making the comparison.)
doc_27687
Compute the embedding vectors for data X Parameters Xarray-like of shape [n_samples, n_features] training set. yIgnored Returns selfreturns an instance of self.
doc_27688
Predict the class labels for the provided data. Parameters Xarray-like of shape (n_queries, n_features), or (n_queries, n_indexed) if metric == ‘precomputed’ Test samples. Returns yndarray of shape (n_queries,) or (n_queries, n_outputs) Class labels for each data sample.
doc_27689
Convert DataFrame to a NumPy record array. Index will be included as the first field of the record array if requested. Parameters index:bool, default True Include index in resulting record array, stored in ‘index’ field or using the index label, if set. column_dtypes:str, type, dict, default None If a string or type, the data type to store all columns. If a dictionary, a mapping of column names and indices (zero-indexed) to specific data types. index_dtypes:str, type, dict, default None If a string or type, the data type to store all index levels. If a dictionary, a mapping of index level names and indices (zero-indexed) to specific data types. This mapping is applied only if index=True. Returns numpy.recarray NumPy ndarray with the DataFrame labels as fields and each row of the DataFrame as entries. See also DataFrame.from_records Convert structured or record ndarray to DataFrame. numpy.recarray An ndarray that allows field access using attributes, analogous to typed columns in a spreadsheet. Examples >>> df = pd.DataFrame({'A': [1, 2], 'B': [0.5, 0.75]}, ... index=['a', 'b']) >>> df A B a 1 0.50 b 2 0.75 >>> df.to_records() rec.array([('a', 1, 0.5 ), ('b', 2, 0.75)], dtype=[('index', 'O'), ('A', '<i8'), ('B', '<f8')]) If the DataFrame index has no label then the recarray field name is set to ‘index’. If the index has a label then this is used as the field name: >>> df.index = df.index.rename("I") >>> df.to_records() rec.array([('a', 1, 0.5 ), ('b', 2, 0.75)], dtype=[('I', 'O'), ('A', '<i8'), ('B', '<f8')]) The index can be excluded from the record array: >>> df.to_records(index=False) rec.array([(1, 0.5 ), (2, 0.75)], dtype=[('A', '<i8'), ('B', '<f8')]) Data types can be specified for the columns: >>> df.to_records(column_dtypes={"A": "int32"}) rec.array([('a', 1, 0.5 ), ('b', 2, 0.75)], dtype=[('I', 'O'), ('A', '<i4'), ('B', '<f8')]) As well as for the index: >>> df.to_records(index_dtypes="<S2") rec.array([(b'a', 1, 0.5 ), (b'b', 2, 0.75)], dtype=[('I', 'S2'), ('A', '<i8'), ('B', '<f8')]) >>> index_dtypes = f"<S{df.index.str.len().max()}" >>> df.to_records(index_dtypes=index_dtypes) rec.array([(b'a', 1, 0.5 ), (b'b', 2, 0.75)], dtype=[('I', 'S1'), ('A', '<i8'), ('B', '<f8')])
doc_27690
Swap the bytes of the array elements Toggle between low-endian and big-endian data representation by returning a byteswapped array, optionally swapped in-place. Arrays of byte-strings are not swapped. The real and imaginary parts of a complex number are swapped individually. Parameters inplacebool, optional If True, swap bytes in-place, default is False. Returns outndarray The byteswapped array. If inplace is True, this is a view to self. Examples >>> A = np.array([1, 256, 8755], dtype=np.int16) >>> list(map(hex, A)) ['0x1', '0x100', '0x2233'] >>> A.byteswap(inplace=True) array([ 256, 1, 13090], dtype=int16) >>> list(map(hex, A)) ['0x100', '0x1', '0x3322'] Arrays of byte-strings are not swapped >>> A = np.array([b'ceg', b'fac']) >>> A.byteswap() array([b'ceg', b'fac'], dtype='|S3') A.newbyteorder().byteswap() produces an array with the same values but different representation in memory >>> A = np.array([1, 2, 3]) >>> A.view(np.uint8) array([1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0], dtype=uint8) >>> A.newbyteorder().byteswap(inplace=True) array([1, 2, 3]) >>> A.view(np.uint8) array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3], dtype=uint8)
doc_27691
Bases: mpl_toolkits.axisartist.angle_helper.LocatorBase __call__(v1, v2)[source] Call self as a function.
doc_27692
Fused multiply-add. Return self*other+third with no rounding of the intermediate product self*other. >>> Decimal(2).fma(3, 5) Decimal('11')
doc_27693
Efficient subpixel image translation registration by cross-correlation. This code gives the same precision as the FFT upsampled cross-correlation in a fraction of the computation time and with reduced memory requirements. It obtains an initial estimate of the cross-correlation peak by an FFT and then refines the shift estimation by upsampling the DFT only in a small neighborhood of that estimate by means of a matrix-multiply DFT. Parameters reference_imagearray Reference image. moving_imagearray Image to register. Must be same dimensionality as reference_image. upsample_factorint, optional Upsampling factor. Images will be registered to within 1 / upsample_factor of a pixel. For example upsample_factor == 20 means the images will be registered within 1/20th of a pixel. Default is 1 (no upsampling). Not used if any of reference_mask or moving_mask is not None. spacestring, one of “real” or “fourier”, optional Defines how the algorithm interprets input data. “real” means data will be FFT’d to compute the correlation, while “fourier” data will bypass FFT of input data. Case insensitive. Not used if any of reference_mask or moving_mask is not None. return_errorbool, optional Returns error and phase difference if on, otherwise only shifts are returned. Has noeffect if any of reference_mask or moving_mask is not None. In this case only shifts is returned. reference_maskndarray Boolean mask for reference_image. The mask should evaluate to True (or 1) on valid pixels. reference_mask should have the same shape as reference_image. moving_maskndarray or None, optional Boolean mask for moving_image. The mask should evaluate to True (or 1) on valid pixels. moving_mask should have the same shape as moving_image. If None, reference_mask will be used. overlap_ratiofloat, optional Minimum allowed overlap ratio between images. The correlation for translations corresponding with an overlap ratio lower than this threshold will be ignored. A lower overlap_ratio leads to smaller maximum translation, while a higher overlap_ratio leads to greater robustness against spurious matches due to small overlap between masked images. Used only if one of reference_mask or moving_mask is None. Returns shiftsndarray Shift vector (in pixels) required to register moving_image with reference_image. Axis ordering is consistent with numpy (e.g. Z, Y, X) errorfloat Translation invariant normalized RMS error between reference_image and moving_image. phasedifffloat Global phase difference between the two images (should be zero if images are non-negative). References 1 Manuel Guizar-Sicairos, Samuel T. Thurman, and James R. Fienup, “Efficient subpixel image registration algorithms,” Optics Letters 33, 156-158 (2008). DOI:10.1364/OL.33.000156 2 James R. Fienup, “Invariant error metrics for image reconstruction” Optics Letters 36, 8352-8357 (1997). DOI:10.1364/AO.36.008352 3 Dirk Padfield. Masked Object Registration in the Fourier Domain. IEEE Transactions on Image Processing, vol. 21(5), pp. 2706-2718 (2012). DOI:10.1109/TIP.2011.2181402 4 D. Padfield. “Masked FFT registration”. In Proc. Computer Vision and Pattern Recognition, pp. 2918-2925 (2010). DOI:10.1109/CVPR.2010.5540032
doc_27694
Back-projection to the original space. Parameters X{array-like, sparse matrix} of shape (n_samples, n_features) The data used to scale along the features axis. If a sparse matrix is provided, it will be converted into a sparse csc_matrix. Additionally, the sparse matrix needs to be nonnegative if ignore_implicit_zeros is False. Returns Xt{ndarray, sparse matrix} of (n_samples, n_features) The projected data.
doc_27695
Convert an image to single-precision (32-bit) floating point format. Parameters imagendarray Input image. force_copybool, optional Force a copy of the data, irrespective of its current dtype. Returns outndarray of float32 Output image. Notes The range of a floating point image is [0.0, 1.0] or [-1.0, 1.0] when converting from unsigned or signed datatypes, respectively. If the input image has a float type, intensity values are not modified and can be outside the ranges [0.0, 1.0] or [-1.0, 1.0].
doc_27696
class tkinter.messagebox.Message(master=None, **options) Create a default information message box. Information message box tkinter.messagebox.showinfo(title=None, message=None, **options) Warning message boxes tkinter.messagebox.showwarning(title=None, message=None, **options) tkinter.messagebox.showerror(title=None, message=None, **options) Question message boxes tkinter.messagebox.askquestion(title=None, message=None, **options) tkinter.messagebox.askokcancel(title=None, message=None, **options) tkinter.messagebox.askretrycancel(title=None, message=None, **options) tkinter.messagebox.askyesno(title=None, message=None, **options) tkinter.messagebox.askyesnocancel(title=None, message=None, **options)
doc_27697
Sets the seed for generating random numbers to a random number for the current GPU. It’s safe to call this function if CUDA is not available; in that case, it is silently ignored. Warning If you are working with a multi-GPU model, this function will only initialize the seed on one GPU. To initialize all GPUs, use seed_all().
doc_27698
Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object. Parameters **paramsdict Estimator parameters. Returns selfestimator instance Estimator instance.
doc_27699
Apply a CSS-styling function column-wise, row-wise, or table-wise. Updates the HTML representation with the result. Parameters func:function func should take a Series if axis in [0,1] and return a list-like object of same length, or a Series, not necessarily of same length, with valid index labels considering subset. func should take a DataFrame if axis is None and return either an ndarray with the same shape or a DataFrame, not necessarily of the same shape, with valid index and columns labels considering subset. Changed in version 1.3.0. Changed in version 1.4.0. axis:{0 or ‘index’, 1 or ‘columns’, None}, default 0 Apply to each column (axis=0 or 'index'), to each row (axis=1 or 'columns'), or to the entire DataFrame at once with axis=None. subset:label, array-like, IndexSlice, optional A valid 2d input to DataFrame.loc[<subset>], or, in the case of a 1d input or single key, to DataFrame.loc[:, <subset>] where the columns are prioritised, to limit data to before applying the function. **kwargs:dict Pass along to func. Returns self:Styler See also Styler.applymap_index Apply a CSS-styling function to headers elementwise. Styler.apply_index Apply a CSS-styling function to headers level-wise. Styler.applymap Apply a CSS-styling function elementwise. Notes The elements of the output of func should be CSS styles as strings, in the format ‘attribute: value; attribute2: value2; …’ or, if nothing is to be applied to that element, an empty string or None. This is similar to DataFrame.apply, except that axis=None applies the function to the entire DataFrame at once, rather than column-wise or row-wise. Examples >>> def highlight_max(x, color): ... return np.where(x == np.nanmax(x.to_numpy()), f"color: {color};", None) >>> df = pd.DataFrame(np.random.randn(5, 2), columns=["A", "B"]) >>> df.style.apply(highlight_max, color='red') >>> df.style.apply(highlight_max, color='blue', axis=1) >>> df.style.apply(highlight_max, color='green', axis=None) Using subset to restrict application to a single column or multiple columns >>> df.style.apply(highlight_max, color='red', subset="A") ... >>> df.style.apply(highlight_max, color='red', subset=["A", "B"]) ... Using a 2d input to subset to select rows in addition to columns >>> df.style.apply(highlight_max, color='red', subset=([0,1,2], slice(None))) ... >>> df.style.apply(highlight_max, color='red', subset=(slice(0,5,2), "A")) ... Using a function which returns a Series / DataFrame of unequal length but containing valid index labels >>> df = pd.DataFrame([[1, 2], [3, 4], [4, 6]], index=["A1", "A2", "Total"]) >>> total_style = pd.Series("font-weight: bold;", index=["Total"]) >>> df.style.apply(lambda s: total_style) See Table Visualization user guide for more details.