repo_name stringlengths 7 65 | path stringlengths 5 185 | copies stringlengths 1 4 | size stringlengths 4 6 | content stringlengths 977 990k | license stringclasses 14
values | hash stringlengths 32 32 | line_mean float64 7.18 99.4 | line_max int64 31 999 | alpha_frac float64 0.25 0.95 | ratio float64 1.5 7.84 | autogenerated bool 1
class | config_or_test bool 2
classes | has_no_keywords bool 2
classes | has_few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pandas-dev/pandas | pandas/io/sql.py | 1 | 77759 | """
Collection of query wrappers / abstractions to both facilitate data
retrieval and to reduce dependency on DB-specific API.
"""
from __future__ import annotations
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from datetime import (
date,
datetime,
time,
)
from f... | bsd-3-clause | 472d70b0eb3b1c9fe6a807457577cdda | 32.662625 | 120 | 0.566689 | 4.320087 | false | false | false | false |
pandas-dev/pandas | pandas/tests/arrays/categorical/test_indexing.py | 1 | 12790 | import math
import numpy as np
import pytest
from pandas import (
NA,
Categorical,
CategoricalIndex,
Index,
Interval,
IntervalIndex,
NaT,
PeriodIndex,
Series,
Timedelta,
Timestamp,
)
import pandas._testing as tm
import pandas.core.common as com
class TestCategoricalIndexi... | bsd-3-clause | b2d42ddb0b7e65abd00be8a58d99cd28 | 32.307292 | 88 | 0.550586 | 3.517602 | false | true | false | false |
pandas-dev/pandas | pandas/tests/frame/methods/test_first_and_last.py | 2 | 2819 | """
Note: includes tests for `last`
"""
import pytest
from pandas import (
DataFrame,
bdate_range,
)
import pandas._testing as tm
class TestFirst:
def test_first_subset(self, frame_or_series):
ts = tm.makeTimeDataFrame(freq="12h")
ts = tm.get_obj(ts, frame_or_series)
result = ts.f... | bsd-3-clause | a8aa6f703d03d9ad731e5e8ce8d36389 | 31.034091 | 87 | 0.572189 | 3.262731 | false | true | false | false |
pandas-dev/pandas | pandas/tests/indexes/numeric/test_join.py | 1 | 15039 | import numpy as np
import pytest
import pandas._testing as tm
from pandas.core.indexes.api import Index
class TestJoinInt64Index:
def test_join_non_unique(self):
left = Index([4, 4, 3, 3])
joined, lidx, ridx = left.join(left, return_indexers=True)
exp_joined = Index([3, 3, 3, 3, 4, 4, 4... | bsd-3-clause | 8b969033526054d000e925f1635ce1a0 | 38.576316 | 88 | 0.568588 | 2.911713 | false | false | false | false |
pandas-dev/pandas | pandas/core/computation/align.py | 1 | 6154 | """
Core eval alignment algorithms.
"""
from __future__ import annotations
from functools import (
partial,
wraps,
)
from typing import (
TYPE_CHECKING,
Callable,
Sequence,
)
import warnings
import numpy as np
from pandas.errors import PerformanceWarning
from pandas.util._exceptions import find_s... | bsd-3-clause | 23e49271fac0e6ce80ba094be5129253 | 27.757009 | 85 | 0.59701 | 3.738761 | false | false | false | false |
pandas-dev/pandas | scripts/no_bool_in_generic.py | 6 | 2801 | """
Check that pandas/core/generic.py doesn't use bool as a type annotation.
There is already the method `bool`, so the alias `bool_t` should be used instead.
This is meant to be run as a pre-commit hook - to run it manually, you can do:
pre-commit run no-bool-in-core-generic --all-files
The function `visit` is... | bsd-3-clause | 85c1ba7b373194e035c81c0e3b4be8b6 | 31.195402 | 111 | 0.623706 | 3.647135 | false | false | false | false |
pandas-dev/pandas | ci/fix_wheels.py | 1 | 1917 | import os
import shutil
import sys
import zipfile
try:
if len(sys.argv) != 3:
raise ValueError(
"User must pass the path to the wheel and the destination directory."
)
wheel_path = sys.argv[1]
dest_dir = sys.argv[2]
# Figure out whether we are building on 32 or 64 bit python... | bsd-3-clause | 2cc607d9f3e96fcd600aa96e30075dcc | 32.051724 | 81 | 0.622848 | 3.454054 | false | false | false | false |
astropy/astropy | astropy/modeling/tests/test_models_quantities.py | 3 | 32205 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# pylint: disable=invalid-name, no-member
import numpy as np
import pytest
from astropy import units as u
from astropy.modeling.bounding_box import ModelBoundingBox
from astropy.modeling.core import fix_inputs
from astropy.modeling.fitting import (
D... | bsd-3-clause | fea9d8145c4cdbc1aeccb1825755134f | 28.600184 | 88 | 0.465952 | 2.917648 | false | false | false | false |
astropy/astropy | astropy/coordinates/builtin_frames/ecliptic.py | 3 | 9356 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from astropy import units as u
from astropy.coordinates import representation as r
from astropy.coordinates.attributes import QuantityAttribute, TimeAttribute
from astropy.coordinates.baseframe import BaseCoordinateFrame, base_doc
from astropy.utils.decor... | bsd-3-clause | c20c996dba5390dbd483afd2cc1d44f6 | 35.404669 | 95 | 0.707674 | 3.721559 | false | false | false | false |
astropy/astropy | astropy/units/format/vounit.py | 3 | 8586 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Handles the "VOUnit" unit format.
"""
import copy
import keyword
import operator
import re
import warnings
from . import core, generic, utils
class VOUnit(generic.Generic):
"""
The IVOA standard for units used by the VO.
This is an im... | bsd-3-clause | 34a6e2e56d90825eeb90792c23a96f7a | 33.761134 | 86 | 0.490333 | 3.902727 | false | false | false | false |
astropy/astropy | astropy/io/misc/asdf/tags/transform/tabular.py | 3 | 3539 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from numpy.testing import assert_array_equal
from astropy import modeling
from astropy import units as u
from astropy.io.misc.asdf.tags.transform.basic import TransformType
from astropy.modeling.bounding_box import ModelBoundingBox
__a... | bsd-3-clause | 6330b3f59c1a2949ee9043352e9e918e | 35.484536 | 71 | 0.55722 | 3.880482 | false | false | false | false |
astropy/astropy | astropy/samp/hub_script.py | 3 | 6077 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import argparse
import copy
import sys
import time
from astropy import __version__, log
from .hub import SAMPHubServer
__all__ = ["hub_script"]
def hub_script(timeout=0):
"""
This main function is executed by the ``samp_hub`` command line to... | bsd-3-clause | 34a3c8c17ed6d1abfd54feca0f5ed798 | 27.397196 | 88 | 0.558664 | 4.214286 | false | false | false | false |
astropy/astropy | astropy/visualization/transform.py | 3 | 1083 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
__all__ = ["BaseTransform", "CompositeTransform"]
class BaseTransform:
"""
A transformation object.
This is used to construct transformations such as scaling, stretching, and
so on.
"""
def __add__(self, other):
return... | bsd-3-clause | a514b120bf3ee71ba6acda22cf97e0da | 25.414634 | 81 | 0.648199 | 4.102273 | false | false | false | false |
astropy/astropy | astropy/io/ascii/qdp.py | 3 | 20227 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This package contains functions for reading and writing QDP tables that are
not meant to be used directly, but instead are available as readers/writers in
`astropy.table`. See :ref:`astropy:table_io` for more details.
"""
import copy
import re
import w... | bsd-3-clause | 50619e24e944f4e070faa06cf7dd72e5 | 30.35969 | 118 | 0.568943 | 3.794222 | false | false | false | false |
astropy/astropy | astropy/utils/tests/test_data_info.py | 3 | 2855 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
import astropy.units as u
from astropy.coordinates import SkyCoord
from astropy.table import QTable
from astropy.table.index import SlicedIndex
from astropy.time import Time
from astropy.utils.data_info import dtype_info_... | bsd-3-clause | 3fc8dfe0dd8fbd0843e351b901052a8e | 27.55 | 83 | 0.595447 | 3.207865 | false | true | false | false |
astropy/astropy | astropy/io/votable/tests/vo_test.py | 3 | 34597 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This is a set of regression tests for vo.
"""
# STDLIB
import difflib
import gzip
import io
import pathlib
import sys
from unittest import mock
import numpy as np
# THIRD-PARTY
import pytest
from numpy.testing import assert_array_equal
from astropy... | bsd-3-clause | 50e78e01e5aa8d33cec381dbe2b65c8f | 31.548964 | 88 | 0.585298 | 3.440872 | false | true | false | false |
astropy/astropy | astropy/convolution/tests/test_convolve_kernels.py | 3 | 4445 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import itertools
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_almost_equal
from astropy import units as u
from astropy.convolution.convolve import convolve, convolve_fft
from astropy.convolution.kernels import (
... | bsd-3-clause | 5a36977f60ffc15c000a0cc16c356df8 | 26.955975 | 74 | 0.554331 | 3.502758 | false | true | false | false |
astropy/astropy | astropy/timeseries/periodograms/lombscargle/implementations/scipy_impl.py | 3 | 2387 | import numpy as np
def lombscargle_scipy(t, y, frequency, normalization="standard", center_data=True):
"""Lomb-Scargle Periodogram
This is a wrapper of ``scipy.signal.lombscargle`` for computation of the
Lomb-Scargle periodogram. This is a relatively fast version of the naive
O[N^2] algorithm, but ca... | bsd-3-clause | 11899f364c2670a9d9e399dc20bea8c1 | 33.1 | 83 | 0.63008 | 3.706522 | false | false | false | false |
astropy/astropy | examples/coordinates/plot_sgr-coordinate-frame.py | 5 | 10531 | r"""
==========================================================
Create a new coordinate class (for the Sagittarius stream)
==========================================================
This document describes in detail how to subclass and define a custom spherical
coordinate frame, as discussed in :ref:`astropy:astropy-c... | bsd-3-clause | d04d27148ce0526dc9c93c7dad4b4b3a | 42.159836 | 90 | 0.660526 | 3.74236 | false | false | false | false |
astropy/astropy | astropy/units/format/fits.py | 3 | 4876 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Handles the "FITS" unit format.
"""
import copy
import keyword
import operator
import numpy as np
from . import core, generic, utils
class Fits(generic.Generic):
"""
The FITS standard unit format.
This supports the format defined in... | bsd-3-clause | 2c99fd7e3c6167fe13d858367d16b22a | 31.078947 | 84 | 0.501231 | 3.818324 | false | false | false | false |
astropy/astropy | astropy/stats/spatial.py | 3 | 12953 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module implements functions and classes for spatial statistics.
"""
import math
import numpy as np
__all__ = ["RipleysKEstimator"]
class RipleysKEstimator:
"""
Estimators for Ripley's K function for two-dimensional spatial data.
... | bsd-3-clause | 6425f744d5ecf84361e082c504e15983 | 35.384831 | 87 | 0.499035 | 3.575214 | false | false | false | false |
astropy/astropy | astropy/units/si.py | 3 | 9129 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This package defines the SI units. They are also available in the
`astropy.units` namespace.
"""
import numpy as _numpy
from astropy.constants import si as _si
from .core import Unit, UnitBase, def_unit
_ns = globals()
#########################... | bsd-3-clause | 89175944427adc7656947ef07ab62750 | 19.165929 | 88 | 0.464619 | 3.383445 | false | false | false | false |
astropy/astropy | astropy/timeseries/periodograms/lombscargle/implementations/fast_impl.py | 3 | 4855 | import numpy as np
from .utils import trig_sum
def lombscargle_fast(
t,
y,
dy,
f0,
df,
Nf,
center_data=True,
fit_mean=True,
normalization="standard",
use_fft=True,
trig_sum_kwds=None,
):
"""Fast Lomb-Scargle Periodogram
This implements the Press & Rybicki method [... | bsd-3-clause | 605933f3365f36834a724afc835465ac | 32.715278 | 82 | 0.576931 | 3.302721 | false | false | false | false |
astropy/astropy | astropy/io/votable/ucd.py | 3 | 5687 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This file contains routines to verify the correctness of UCD strings.
"""
# STDLIB
import re
# LOCAL
from astropy.utils import data
__all__ = ["parse_ucd", "check_ucd"]
class UCDWords:
"""
Manages a list of acceptable UCD words.
Work... | bsd-3-clause | 607fc3a166070a075d9db202e77da7b6 | 28.314433 | 87 | 0.550906 | 4.157164 | false | false | false | false |
astropy/astropy | astropy/modeling/statistic.py | 3 | 5416 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Statistic functions used in `~astropy.modeling.fitting`.
"""
# pylint: disable=invalid-name
import numpy as np
__all__ = ["leastsquare", "leastsquare_1d", "leastsquare_2d", "leastsquare_3d"]
def leastsquare(measured_vals, updated_model, weights, *x... | bsd-3-clause | 354e92157840b6a10a22c6bafd6b543c | 30.306358 | 79 | 0.649372 | 4.179012 | false | false | false | false |
astropy/astropy | astropy/stats/biweight.py | 3 | 27611 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains functions for computing robust statistics using
Tukey's biweight function.
"""
import numpy as np
from .funcs import median_absolute_deviation
__all__ = [
"biweight_location",
"biweight_scale",
"biweight_midvariance"... | bsd-3-clause | df743a15e726e9f7dc8f35b3c1aef341 | 35.378129 | 131 | 0.621817 | 3.554912 | false | false | false | false |
astropy/astropy | astropy/timeseries/periodograms/lombscargle/implementations/main.py | 3 | 7564 | """
Main Lomb-Scargle Implementation
The ``lombscargle`` function here is essentially a sophisticated switch
statement for the various implementations available in this submodule
"""
__all__ = ["lombscargle", "available_methods"]
import numpy as np
from .chi2_impl import lombscargle_chi2
from .cython_impl import lo... | bsd-3-clause | 474ae0c16dc13b4b43d9f41866e90fa8 | 31.744589 | 87 | 0.639344 | 4.036286 | false | false | false | false |
astropy/astropy | astropy/wcs/wcsapi/wrappers/tests/test_sliced_wcs.py | 3 | 33901 | import warnings
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_equal
import astropy.units as u
from astropy.coordinates import ICRS, Galactic, SkyCoord
from astropy.io.fits import Header
from astropy.io.fits.verify import VerifyWarning
from astropy.time import Time
from astropy.uni... | bsd-3-clause | dc21bd99877124d548a0765913f065a7 | 30.535814 | 87 | 0.601841 | 2.950479 | false | false | false | false |
astropy/astropy | astropy/cosmology/io/model.py | 3 | 9400 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
The following are private functions, included here **FOR REFERENCE ONLY** since
the io registry cannot be displayed. These functions are registered into
:meth:`~astropy.cosmology.Cosmology.to_format` and
:meth:`~astropy.cosmology.Cosmology.from_format... | bsd-3-clause | 226d6118670145c7a2dcefb026008f41 | 33.558824 | 86 | 0.612128 | 3.743528 | false | false | false | false |
astropy/astropy | astropy/time/tests/test_delta.py | 3 | 22673 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
import itertools
import operator
from datetime import timedelta
from decimal import Decimal
import numpy as np
import pytest
from astropy import units as u
from astropy.table import Table
from astropy.time import (
STANDARD_TIME_SCAL... | bsd-3-clause | 6a3970d3e4e6a65299504fed74ec2164 | 32.002911 | 84 | 0.559388 | 3.171493 | false | true | false | false |
astropy/astropy | astropy/cosmology/funcs/tests/test_funcs.py | 3 | 13389 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import inspect
import sys
from io import StringIO
import numpy as np
import pytest
from astropy import units as u
from astropy.cosmology import core, flrw
from astropy.cosmology.funcs import _z_at_scalar_value, z_at_value
from astropy.cosmology.realizat... | bsd-3-clause | 62aea4a077009fc5189a1f12a571ba88 | 31.418886 | 97 | 0.55456 | 3.457903 | false | true | false | false |
astropy/astropy | astropy/io/misc/tests/test_parquet.py | 3 | 22139 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from astropy import units as u
from astropy.coordinates import (
Angle,
CartesianRepresentation,
EarthLocation,
Latitude,
Longitude,
SkyCoord,
SphericalCosLatDifferential,
SphericalRepresen... | bsd-3-clause | 4d47dd02a6ea300ab229a3cda4db2a51 | 28.245707 | 91 | 0.59009 | 3.068043 | false | true | false | false |
astropy/astropy | astropy/coordinates/tests/test_unit_representation.py | 3 | 2792 | """
This file tests the behavior of subclasses of Representation and Frames
"""
from copy import deepcopy
import astropy.coordinates
import astropy.units as u
from astropy.coordinates import ICRS, Latitude, Longitude
from astropy.coordinates.baseframe import RepresentationMapping, frame_transform_graph
from astropy.co... | bsd-3-clause | 277a66fc865401afe5d655c379170314 | 33.9 | 86 | 0.703438 | 4.093842 | false | false | false | false |
astropy/astropy | astropy/samp/tests/web_profile_test_helpers.py | 3 | 9400 | import threading
import time
import xmlrpc.client as xmlrpc
from astropy.samp.client import SAMPClient
from astropy.samp.errors import SAMPClientError, SAMPHubError
from astropy.samp.hub import WebProfileDialog
from astropy.samp.hub_proxy import SAMPHubProxy
from astropy.samp.integrated_client import SAMPIntegratedCli... | bsd-3-clause | a2be2f69a3a5d373478aa7f66f0e8151 | 32.215548 | 88 | 0.601489 | 4.47406 | false | false | false | false |
astropy/astropy | astropy/table/pprint.py | 3 | 30057 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import fnmatch
import os
import re
import sys
import numpy as np
from astropy import log
from astropy.utils.console import Getch, color_print, conf, terminal_size
from astropy.utils.data_info import dtype_info_name
__all__ = []
def default_format_fun... | bsd-3-clause | c17798f42909f91af6a91ae8f3113c49 | 34.444575 | 92 | 0.529095 | 4.374472 | false | false | false | false |
astropy/astropy | astropy/coordinates/builtin_frames/itrs_observed_transforms.py | 3 | 5672 | import erfa
import numpy as np
from astropy import units as u
from astropy.coordinates.baseframe import frame_transform_graph
from astropy.coordinates.matrix_utilities import matrix_transpose, rotation_matrix
from astropy.coordinates.representation import CartesianRepresentation
from astropy.coordinates.transformation... | bsd-3-clause | c9c67bb6d2e5189993f749fba97747d2 | 37.585034 | 86 | 0.661495 | 2.96808 | false | false | false | false |
astropy/astropy | astropy/stats/jackknife.py | 3 | 5907 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
__all__ = ["jackknife_resampling", "jackknife_stats"]
__doctest_requires__ = {"jackknife_stats": ["scipy"]}
def jackknife_resampling(data):
"""Performs jackknife resampling on numpy arrays.
Jackknife resampling is a techniqu... | bsd-3-clause | e9d986675b695f3c4daa5a92b021cee6 | 32.185393 | 86 | 0.602675 | 3.464516 | false | false | false | false |
astropy/astropy | astropy/units/quantity_helper/helpers.py | 3 | 15123 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# The idea for this module (but no code) was borrowed from the
# quantities (http://pythonhosted.org/quantities/) package.
"""Helper functions for Quantity.
In particular, this implements the logic that determines scaling and result
units for a given ufun... | bsd-3-clause | 0f34daba7c18458aff16a9292ff2ca38 | 29.306613 | 87 | 0.668518 | 3.513708 | false | false | false | false |
astropy/astropy | astropy/coordinates/tests/test_celestial_transformations.py | 3 | 15888 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from astropy import units as u
from astropy.coordinates import (
CartesianDifferential,
CartesianRepresentation,
EarthLocation,
SkyCoord,
galactocentric_frame_defaults,
)
from astropy.coordinates.built... | bsd-3-clause | 1d624807977d7415dbd26ed0cf485c24 | 34.543624 | 88 | 0.637273 | 2.777137 | false | true | false | false |
astropy/astropy | astropy/cosmology/tests/test_units.py | 3 | 15708 | """Testing :mod:`astropy.cosmology.units`."""
##############################################################################
# IMPORTS
import pytest
import astropy.cosmology.units as cu
import astropy.units as u
from astropy.cosmology import Planck13, default_cosmology
from astropy.tests.helper import assert_quantit... | bsd-3-clause | 410d59b7e377d1138b7619c598962561 | 38.467337 | 87 | 0.63369 | 3.254195 | false | true | false | false |
astropy/astropy | astropy/visualization/wcsaxes/helpers.py | 3 | 6100 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Helpers functions for different kinds of WCSAxes instances
"""
import numpy as np
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredEllipse, AnchoredSizeBar
import astropy.units as u
from astropy.wcs.utils import proj_plane_pixel_scales
... | bsd-3-clause | 3eb626529cc605438ebfae3982eba320 | 28.901961 | 85 | 0.624262 | 3.870558 | false | false | false | false |
astropy/astropy | astropy/convolution/core.py | 3 | 12177 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains the convolution and filter functionalities of astropy.
A few conceptual notes:
A filter kernel is mainly characterized by its response function. In the 1D
case we speak of "impulse response function", in the 2D case we call it "po... | bsd-3-clause | 4e1381d38ef8fef24de4ec1d2459de8e | 30.762402 | 83 | 0.562022 | 4.28798 | false | false | false | false |
astropy/astropy | astropy/convolution/tests/test_convolve_fft.py | 3 | 35262 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import itertools
from contextlib import nullcontext
import numpy as np
import pytest
from numpy.testing import (
assert_allclose,
assert_array_almost_equal_nulp,
assert_array_equal,
)
from astropy import units as u
from astropy.convolution.c... | bsd-3-clause | 2acc0f3bd036b0f95c5f3f12c41b68ab | 34.191617 | 92 | 0.531195 | 3.574093 | false | true | false | false |
astropy/astropy | astropy/time/core.py | 3 | 124592 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
The astropy.time package provides functionality for manipulating times and
dates. Specific emphasis is placed on supporting time scales (e.g. UTC, TAI,
UT1) and time representations (e.g. JD, MJD, ISO 8601) that are used in
astronomy.
"""
import copy
... | bsd-3-clause | 0ff87c7f001cee8f333401f0ec51045e | 36.539018 | 107 | 0.569298 | 4.168351 | false | false | false | false |
astropy/astropy | astropy/coordinates/sky_coordinate.py | 3 | 91316 | import copy
import operator
import re
import warnings
import erfa
import numpy as np
from astropy import units as u
from astropy.constants import c as speed_of_light
from astropy.table import QTable
from astropy.time import Time
from astropy.utils import ShapedLikeNDArray
from astropy.utils.data_info import MixinInfo... | bsd-3-clause | cbda1055bc50222a32892ca84d297419 | 40.077823 | 139 | 0.595383 | 4.379454 | false | false | false | false |
astropy/astropy | astropy/io/fits/scripts/fitsinfo.py | 3 | 2044 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
``fitsinfo`` is a command-line script based on astropy.io.fits for
printing a summary of the HDUs in one or more FITS files(s) to the
standard output.
Example usage of ``fitsinfo``:
1. Print a summary of the HDUs in a FITS file::
$ fitsinfo file... | bsd-3-clause | 503c79168a05e30cf797408c4d908844 | 26.253333 | 101 | 0.618395 | 3.65 | false | false | false | false |
astropy/astropy | astropy/cosmology/core.py | 3 | 22120 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import annotations
import abc
import inspect
from typing import TYPE_CHECKING, Any, Mapping, TypeVar
import numpy as np
from astropy.io.registry import UnifiedReadWriteMethod
from astropy.utils.decorators import classproperty
from astro... | bsd-3-clause | 8ccaa83149f40ed50558e97b0dde3a4f | 35.143791 | 88 | 0.57509 | 4.277703 | false | false | false | false |
astropy/astropy | astropy/io/misc/asdf/tags/coordinates/frames.py | 3 | 4873 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import glob
import os
import warnings
from asdf import tagged
import astropy.coordinates
import astropy.units as u
from astropy.coordinates import ICRS, Angle, Latitude, Longitude
from astropy.coordinates.baseframe import frame_transform_graph
from astro... | bsd-3-clause | 859be89bec225afa352188d01819bd9c | 28.005952 | 84 | 0.605171 | 3.748462 | false | false | false | false |
astropy/astropy | astropy/io/fits/card.py | 3 | 50925 | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import re
import warnings
import numpy as np
from astropy.utils.exceptions import AstropyUserWarning
from . import conf
from .util import _is_int, _str_to_num, _words_group, translate
from .verify import VerifyError, VerifyWarning, _ErrList, _Verify
__... | bsd-3-clause | cfcab311bc3ac51eb76412cc55b24ca5 | 35.84877 | 88 | 0.537614 | 4.341802 | false | false | false | false |
astropy/astropy | astropy/visualization/scripts/tests/test_fits2bitmap.py | 3 | 2470 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from astropy.io import fits
from astropy.utils.compat.optional_deps import HAS_MATPLOTLIB
if HAS_MATPLOTLIB:
import matplotlib.image as mpimg
from astropy.visualization.scripts.fits2bitmap import fits2bitmap, ma... | bsd-3-clause | 91cf34a3b1883b56bf601faf561947ff | 31.933333 | 75 | 0.625101 | 3.355978 | false | true | false | false |
astropy/astropy | astropy/cosmology/io/tests/test_html.py | 3 | 10462 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# THIRD PARTY
import pytest
import astropy.units as u
from astropy.cosmology.io.html import _FORMAT_TABLE, read_html_table, write_html_table
from astropy.cosmology.parameter import Parameter
from astropy.table import QTable, Table, vstack
from a... | bsd-3-clause | e822d65d6611554a9ed10d2e104e11ca | 38.084291 | 97 | 0.603422 | 3.851988 | false | true | false | false |
scikit-learn/scikit-learn | sklearn/svm/_base.py | 9 | 42504 | import warnings
from abc import ABCMeta, abstractmethod
from numbers import Integral, Real
import numpy as np
import scipy.sparse as sp
# mypy error: error: Module 'sklearn.svm' has no attribute '_libsvm'
# (and same for other imports)
from . import _libsvm as libsvm # type: ignore
from . import _liblinear as liblin... | bsd-3-clause | 9299d30d812ccc0005715fa9cfd2a244 | 32.840764 | 88 | 0.559594 | 4.071654 | false | false | false | false |
scikit-learn/scikit-learn | examples/release_highlights/plot_release_highlights_1_2_0.py | 1 | 3558 | # flake8: noqa
"""
=======================================
Release Highlights for scikit-learn 1.2
=======================================
.. currentmodule:: sklearn
We are pleased to announce the release of scikit-learn 1.2! Many bug fixes
and improvements were added, as well as some new key features. We detail
belo... | bsd-3-clause | 8d7bf09be36755f38e94874d9bf73edd | 37.673913 | 94 | 0.671726 | 3.572289 | false | false | false | false |
scikit-learn/scikit-learn | sklearn/naive_bayes.py | 8 | 56302 | """
The :mod:`sklearn.naive_bayes` module implements Naive Bayes algorithms. These
are supervised learning methods based on applying Bayes' theorem with strong
(naive) feature independence assumptions.
"""
# Author: Vincent Michel <vincent.michel@inria.fr>
# Minor fixes by Fabian Pedregosa
# Amit Aides... | bsd-3-clause | 69882a49372765f87fafeff8dc433067 | 35.796078 | 92 | 0.602419 | 3.962694 | false | false | false | false |
scikit-learn/scikit-learn | examples/neighbors/plot_caching_nearest_neighbors.py | 13 | 2682 | """
=========================
Caching nearest neighbors
=========================
This examples demonstrates how to precompute the k nearest neighbors before
using them in KNeighborsClassifier. KNeighborsClassifier can compute the
nearest neighbors internally, but precomputing them can have several benefits,
such as f... | bsd-3-clause | b021d8548d2bcc26fbf50417b18b48b1 | 37.869565 | 87 | 0.746458 | 3.831429 | false | false | false | false |
scikit-learn/scikit-learn | examples/gaussian_process/plot_gpr_noisy_targets.py | 12 | 5306 | """
=========================================================
Gaussian Processes regression: basic introductory example
=========================================================
A simple one-dimensional regression example computed in two different ways:
1. A noise-free case
2. A noisy case with known noise-level per ... | bsd-3-clause | 781aea376de21d023fc3efea56b619d1 | 33.679739 | 82 | 0.705051 | 3.477064 | false | false | false | false |
pydanny/cookiecutter-django | {{cookiecutter.project_slug}}/config/urls.py | 2 | 2353 | from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
{%- if cookiecutter.use_async == 'y' %}
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
{%- endif %}
from django.urls import include, path
from django.views import defaults as default_views
f... | bsd-3-clause | c8b5c437c6a2c6c0d8d83a1fbc6b6266 | 35.2 | 93 | 0.640034 | 3.857377 | false | false | false | false |
scikit-learn/scikit-learn | sklearn/preprocessing/_data.py | 4 | 119368 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Eric Martin <eric@ericmart.in>
# Giorgio Patrini <giorgio.patrini@anu.edu.au>
# ... | bsd-3-clause | 9a298c11008a34b63dedbcec748b22fa | 33.578795 | 88 | 0.592958 | 4.122466 | false | false | false | false |
scikit-learn/scikit-learn | doc/tutorial/machine_learning_map/parse_path.py | 12 | 7398 | #!/usr/local/bin/python
"""
Based on: http://wxpsvg.googlecode.com/svn/trunk/svg/pathdata.py
According to that project, this file is licensed under the LGPL
"""
try:
from pyparsing import (ParserElement, Literal, Word, CaselessLiteral,
Optional, Combine, Forward, ZeroOrMore, nums, oneOf, Group, ... | bsd-3-clause | 5c5f8a7a7837e087521f31e815c82dc2 | 36.53125 | 97 | 0.667748 | 3.19568 | false | false | false | false |
scikit-learn/scikit-learn | examples/cluster/plot_dbscan.py | 3 | 3999 | """
===================================
Demo of DBSCAN clustering algorithm
===================================
DBSCAN (Density-Based Spatial Clustering of Applications with Noise) finds core
samples in regions of high density and expands clusters from them. This
algorithm is good for data which contains clusters of s... | bsd-3-clause | 999bc10e8a391000a80644679b5b7be7 | 30.242188 | 85 | 0.684921 | 3.31592 | false | false | false | false |
scikit-learn/scikit-learn | benchmarks/bench_plot_incremental_pca.py | 16 | 5559 | """
========================
IncrementalPCA benchmark
========================
Benchmarks for IncrementalPCA
"""
import numpy as np
import gc
from time import time
from collections import defaultdict
import matplotlib.pyplot as plt
from sklearn.datasets import fetch_lfw_people
from sklearn.decomposition import Incre... | bsd-3-clause | 87e4f3bdb5f2c1cfc473e563c51ffc00 | 34.407643 | 88 | 0.626731 | 3.346779 | false | false | false | false |
scikit-learn/scikit-learn | benchmarks/bench_sparsify.py | 12 | 3356 | """
Benchmark SGD prediction time with dense/sparse coefficients.
Invoke with
-----------
$ kernprof.py -l sparsity_benchmark.py
$ python -m line_profiler sparsity_benchmark.py.lprof
Typical output
--------------
input data sparsity: 0.050000
true coef sparsity: 0.000100
test data sparsity: 0.027400
model sparsity:... | bsd-3-clause | c824bf714d4d165f81ecaa841507f0cd | 30.660377 | 87 | 0.575089 | 3.199237 | false | true | false | false |
scikit-learn/scikit-learn | sklearn/neighbors/_classification.py | 8 | 26187 | """Nearest Neighbor Classification"""
# Authors: Jake Vanderplas <vanderplas@astro.washington.edu>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Sparseness support by Lars Buitinck
# Multi-output support by Arnaud Joly <a.joly@ul... | bsd-3-clause | 09cdadf4ee8dabfc02047a798a78059a | 35.72791 | 86 | 0.587811 | 4.180556 | false | false | false | false |
scikit-learn/scikit-learn | sklearn/mixture/_gaussian_mixture.py | 9 | 29207 | """Gaussian Mixture Model."""
# Author: Wei Xue <xuewei4d@gmail.com>
# Modified by Thierry Guillemot <thierry.guillemot.work@gmail.com>
# License: BSD 3 clause
import numpy as np
from scipy import linalg
from ._base import BaseMixture, _check_shape
from ..utils import check_array
from ..utils.extmath import row_nor... | bsd-3-clause | 735d418ac9b4fc19ffa6704d8f5cf94f | 33.240328 | 88 | 0.603314 | 3.985128 | false | false | false | false |
scikit-learn/scikit-learn | examples/model_selection/plot_nested_cross_validation_iris.py | 13 | 4476 | """
=========================================
Nested versus non-nested cross-validation
=========================================
This example compares non-nested and nested cross-validation strategies on a
classifier of the iris data set. Nested cross-validation (CV) is often used to
train a model in which hyperparam... | bsd-3-clause | 4f7a53c79b983b4a6b0f9472983d6d48 | 34.244094 | 79 | 0.717158 | 3.411585 | false | false | false | false |
scikit-learn/scikit-learn | examples/covariance/plot_sparse_cov.py | 12 | 5002 | """
======================================
Sparse inverse covariance estimation
======================================
Using the GraphicalLasso estimator to learn a covariance and sparse precision
from a small number of samples.
To estimate a probabilistic model (e.g. a Gaussian model), estimating the
precision matri... | bsd-3-clause | bec65f2c212030c22055880b9dbed4e0 | 30.658228 | 84 | 0.70092 | 3.414334 | false | false | false | false |
scikit-learn/scikit-learn | sklearn/base.py | 4 | 37220 | """Base classes for all estimators."""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD 3 clause
import copy
import warnings
from collections import defaultdict
import platform
import inspect
import re
import numpy as np
from . import __version__
from ._config import get_config
from .utils im... | bsd-3-clause | c18298990493e5064d718d78cdac9860 | 34.857418 | 88 | 0.575605 | 4.393296 | false | false | false | false |
scikit-learn/scikit-learn | sklearn/inspection/_plot/decision_boundary.py | 2 | 13204 | from functools import reduce
import numpy as np
from ...preprocessing import LabelEncoder
from ...utils import check_matplotlib_support
from ...utils import _safe_indexing
from ...base import is_regressor
from ...utils.validation import check_is_fitted, _is_arraylike_not_scalar
def _check_boundary_response_method(e... | bsd-3-clause | 4427f261d0e7ed39d4eaabc081b952ed | 35.175342 | 88 | 0.592018 | 4.219879 | false | false | false | false |
scikit-learn/scikit-learn | sklearn/impute/_iterative.py | 1 | 34743 | from time import time
from collections import namedtuple
from numbers import Integral, Real
import warnings
from scipy import stats
import numpy as np
from ..base import clone
from ..exceptions import ConvergenceWarning
from ..preprocessing import normalize
from ..utils import (
check_array,
check_random_stat... | bsd-3-clause | d245a91518fb1d7006864f849f761ab1 | 38.08099 | 88 | 0.594336 | 4.081649 | false | false | false | false |
scikit-learn/scikit-learn | sklearn/model_selection/_split.py | 8 | 95127 | """
The :mod:`sklearn.model_selection._split` module includes classes and
functions to split the data based on a preset strategy.
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Raghav ... | bsd-3-clause | 582bbb1f988ca38040937bc2380b3fee | 34.284496 | 89 | 0.592997 | 3.887336 | false | true | false | false |
scikit-learn/scikit-learn | examples/cross_decomposition/plot_compare_cross_decomposition.py | 12 | 4806 | """
===================================
Compare cross decomposition methods
===================================
Simple usage of various cross decomposition algorithms:
- PLSCanonical
- PLSRegression, with multivariate response, a.k.a. PLS2
- PLSRegression, with univariate response, a.k.a. PLS1
- CCA
Given 2 multivar... | bsd-3-clause | a1d852f868b632dc3de138a6c1e8c6ab | 27.105263 | 78 | 0.605909 | 2.709132 | false | true | false | false |
scikit-learn/scikit-learn | benchmarks/bench_plot_randomized_svd.py | 12 | 18108 | """
Benchmarks on the power iterations phase in randomized SVD.
We test on various synthetic and real datasets the effect of increasing
the number of power iterations in terms of quality of approximation
and running time. A number greater than 0 should help with noisy matrices,
which are characterized by a slow spectr... | bsd-3-clause | 6cabca52493692fe6751efc02e4b5868 | 33.230624 | 88 | 0.581566 | 3.425653 | false | false | false | false |
scikit-learn/scikit-learn | sklearn/datasets/tests/test_openml.py | 12 | 54065 | """Test the openml loader."""
import gzip
import json
import os
import re
from functools import partial
from importlib import resources
from io import BytesIO
from urllib.error import HTTPError
import numpy as np
import scipy.sparse
import pytest
import sklearn
from sklearn import config_context
from sklearn.utils im... | bsd-3-clause | 8069f1655407df4ae4467731e61a144d | 32.47678 | 88 | 0.588865 | 3.434879 | false | true | false | false |
scikit-learn/scikit-learn | sklearn/multiclass.py | 9 | 36636 | """
Multiclass classification strategies
====================================
This module implements multiclass learning algorithms:
- one-vs-the-rest / one-vs-all
- one-vs-one
- error correcting output codes
The estimators provided in this module are meta-estimators: they require a base
estimator to be p... | bsd-3-clause | 4dc9e30ec744b309dc545f94af4d780a | 34.091954 | 87 | 0.599001 | 4.120571 | false | false | false | false |
scikit-learn/scikit-learn | sklearn/feature_extraction/image.py | 9 | 19739 | """
The :mod:`sklearn.feature_extraction.image` submodule gathers utilities to
extract features from images.
"""
# Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Olivier Grisel
# Vlad Niculae
# License: BSD 3 clause
fro... | bsd-3-clause | c413c44434a0fd0220b4a72fe755d094 | 32.455932 | 85 | 0.59998 | 3.690222 | false | false | false | false |
scikit-learn/scikit-learn | sklearn/datasets/_covtype.py | 12 | 6938 | """Forest covertype dataset.
A classic dataset for classification benchmarks, featuring categorical and
real-valued features.
The dataset page is available from UCI Machine Learning Repository
https://archive.ics.uci.edu/ml/datasets/Covertype
Courtesy of Jock A. Blackard and Colorado State University.
"""
# Au... | bsd-3-clause | ec40157b813889c29f1e814f77e36981 | 31.726415 | 83 | 0.640819 | 3.826806 | false | false | false | false |
scikit-learn/scikit-learn | sklearn/metrics/_pairwise_distances_reduction/__init__.py | 4 | 4467 | # Pairwise Distances Reductions
# =============================
#
# Author: Julien Jerphanion <git@jjerphan.xyz>
#
# Overview
# --------
#
# This module provides routines to compute pairwise distances between a set
# of row vectors of X and another set of row vectors of Y and apply a
# reduction on top. The... | bsd-3-clause | 779c2d0538bd4b3b55df603744fe5a53 | 43.128713 | 85 | 0.466233 | 4.408506 | false | false | false | false |
scikit-learn/scikit-learn | examples/semi_supervised/plot_label_propagation_structure.py | 8 | 2710 | """
==============================================
Label Propagation learning a complex structure
==============================================
Example of LabelPropagation learning a complex internal structure
to demonstrate "manifold learning". The outer circle should be
labeled "red" and the inner circle "blue". Be... | bsd-3-clause | 66b39cac762e31844f7a01f735ceb208 | 24.809524 | 77 | 0.654982 | 3.237754 | false | false | true | false |
scikit-learn/scikit-learn | sklearn/neural_network/tests/test_rbm.py | 4 | 7762 | import sys
import re
import pytest
import numpy as np
from scipy.sparse import csc_matrix, csr_matrix, lil_matrix
from sklearn.utils._testing import (
assert_almost_equal,
assert_array_equal,
assert_allclose,
)
from sklearn.datasets import load_digits
from io import StringIO
from sklearn.neural_network im... | bsd-3-clause | a79edd376d3263e28c01d843cf09795a | 30.298387 | 84 | 0.644679 | 2.959207 | false | true | false | false |
scikit-learn/scikit-learn | examples/svm/plot_linearsvc_support_vectors.py | 12 | 1805 | """
=====================================
Plot the support vectors in LinearSVC
=====================================
Unlike SVC (based on LIBSVM), LinearSVC (based on LIBLINEAR) does not provide
the support vectors. This example demonstrates how to obtain the support
vectors in LinearSVC.
"""
import numpy as np
imp... | bsd-3-clause | 8a320792298ed42419e67d378331ee97 | 30.666667 | 80 | 0.617729 | 3.588469 | false | false | false | false |
scikit-learn/scikit-learn | benchmarks/bench_random_projections.py | 12 | 8566 | """
===========================
Random projection benchmark
===========================
Benchmarks for random projections.
"""
import gc
import sys
import optparse
from datetime import datetime
import collections
import numpy as np
import scipy.sparse as sp
from sklearn import clone
from sklearn.random_projection i... | bsd-3-clause | 4c493e182df5d6a5db52671565b152c6 | 27.270627 | 87 | 0.497548 | 4.118269 | false | false | false | false |
scikit-learn/scikit-learn | sklearn/utils/_pprint.py | 13 | 18516 | """This module contains the _EstimatorPrettyPrinter class used in
BaseEstimator.__repr__ for pretty-printing estimators"""
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Python Software Foundation;
# All Rights Reserved
# Authors: Fred L. D... | bsd-3-clause | 2e84fef264f67109704cd35cc9c45853 | 38.991361 | 87 | 0.603694 | 4.243869 | false | false | false | false |
scikit-learn/scikit-learn | asv_benchmarks/benchmarks/cluster.py | 8 | 2925 | from sklearn.cluster import KMeans, MiniBatchKMeans
from .common import Benchmark, Estimator, Predictor, Transformer
from .datasets import _blobs_dataset, _20newsgroups_highdim_dataset
from .utils import neg_mean_inertia
class KMeansBenchmark(Predictor, Transformer, Estimator, Benchmark):
"""
Benchmarks for ... | bsd-3-clause | b70a2e9c3135dc2c40880702197eec8b | 27.125 | 83 | 0.577778 | 4.001368 | false | false | false | false |
scikit-learn/scikit-learn | examples/cluster/plot_kmeans_plusplus.py | 13 | 1167 | """
===========================================================
An example of K-Means++ initialization
===========================================================
An example to show the output of the :func:`sklearn.cluster.kmeans_plusplus`
function for generating initial seeds for clustering.
K-Means++ is used as the... | bsd-3-clause | 587066d14cb2718081ee32b5fe704478 | 27.463415 | 80 | 0.628963 | 3.29661 | false | false | false | false |
scikit-learn/scikit-learn | examples/miscellaneous/plot_pipeline_display.py | 12 | 6254 | """
=================================================================
Displaying Pipelines
=================================================================
The default configuration for displaying a pipeline in a Jupyter Notebook is
`'diagram'` where `set_config(display='diagram')`. To deactivate HTML representation,... | bsd-3-clause | 1077c94f87dd5bc3c03aea2b58c439c8 | 33.744444 | 85 | 0.670451 | 4.432318 | false | false | false | false |
scikit-learn/scikit-learn | examples/svm/plot_separating_hyperplane.py | 12 | 1114 | """
=========================================
SVM: Maximum margin separating hyperplane
=========================================
Plot the maximum margin separating hyperplane within a two-class
separable dataset using a Support Vector Machine classifier with
linear kernel.
"""
import matplotlib.pyplot as plt
from s... | bsd-3-clause | f4cf9f940b55008aeab16f2ff66b69b9 | 22.208333 | 64 | 0.633752 | 3.448916 | false | false | false | false |
scikit-learn/scikit-learn | examples/preprocessing/plot_discretization_classification.py | 13 | 7753 | # -*- coding: utf-8 -*-
"""
======================
Feature discretization
======================
A demonstration of feature discretization on synthetic classification datasets.
Feature discretization decomposes each feature into a set of bins, here equally
distributed in width. The discrete values are then one-hot enc... | bsd-3-clause | 0c9f59c73af7ca44463c60b18a4a9776 | 32.261803 | 88 | 0.627613 | 3.519528 | false | true | false | false |
scikit-learn/scikit-learn | examples/neighbors/plot_lof_outlier_detection.py | 13 | 2750 | """
=================================================
Outlier detection with Local Outlier Factor (LOF)
=================================================
The Local Outlier Factor (LOF) algorithm is an unsupervised anomaly detection
method which computes the local density deviation of a given data point with
respect to... | bsd-3-clause | 1c4194a7f0e08945e1ed55e444b4dccc | 36.671233 | 77 | 0.715273 | 3.498728 | false | false | false | false |
scikit-learn/scikit-learn | sklearn/svm/_bounds.py | 2 | 2911 | """Determination of parameter bounds"""
# Author: Paolo Losi
# License: BSD 3 clause
from numbers import Real
import numpy as np
from ..preprocessing import LabelBinarizer
from ..utils.validation import check_consistent_length, check_array
from ..utils.extmath import safe_sparse_dot
from ..utils._param_validation im... | bsd-3-clause | 48573472567c88c36051c6b7438e3a2b | 33.247059 | 87 | 0.637582 | 3.795306 | false | false | false | false |
scikit-learn/scikit-learn | examples/linear_model/plot_iris_logistic.py | 12 | 1406 | # -*- coding: utf-8 -*-
"""
=========================================================
Logistic Regression 3-class Classifier
=========================================================
Show below is a logistic-regression classifiers decision boundaries on the
first two dimensions (sepal length and width) of the `iris
<h... | bsd-3-clause | 6b7715c2fba3a7a266143183b56d0eaf | 25.509434 | 78 | 0.662633 | 3.584184 | false | false | false | false |
scikit-learn/scikit-learn | examples/cluster/plot_coin_ward_segmentation.py | 12 | 2376 | """
======================================================================
A demo of structured Ward hierarchical clustering on an image of coins
======================================================================
Compute the segmentation of a 2D image with Ward hierarchical
clustering. The clustering is spatially ... | bsd-3-clause | d180e9b8d9e39b30656f7a02b470ff20 | 24.548387 | 79 | 0.649411 | 3.578313 | false | false | false | false |
scikit-learn/scikit-learn | examples/neighbors/plot_species_kde.py | 12 | 4756 | """
================================================
Kernel Density Estimate of Species Distributions
================================================
This shows an example of a neighbors-based query (in particular a kernel
density estimate) on geospatial data, using a Ball Tree built upon the
Haversine distance metric... | bsd-3-clause | 179ea12c49e5911e3714256e393f84fe | 30.496689 | 89 | 0.656013 | 3.363508 | false | false | false | false |
scikit-learn/scikit-learn | examples/svm/plot_weighted_samples.py | 12 | 2047 | """
=====================
SVM: Weighted samples
=====================
Plot decision function of a weighted dataset, where the size of points
is proportional to its weight.
The sample weighting rescales the C parameter, which means that the classifier
puts more emphasis on getting these points right. The effect might ... | bsd-3-clause | b9bb82c3f324bf5e88d79e3e5cf46bc7 | 27.830986 | 88 | 0.675134 | 3.198438 | false | false | false | false |
scikit-learn/scikit-learn | build_tools/github/vendor.py | 4 | 3038 | """Embed vcomp140.dll and msvcp140.dll."""
import os
import os.path as op
import shutil
import sys
import textwrap
TARGET_FOLDER = op.join("sklearn", ".libs")
DISTRIBUTOR_INIT = op.join("sklearn", "_distributor_init.py")
VCOMP140_SRC_PATH = "C:\\Windows\\System32\\vcomp140.dll"
MSVCP140_SRC_PATH = "C:\\Windows\\Sys... | bsd-3-clause | 338872134b4b322333db0185049c8df0 | 30 | 73 | 0.620803 | 3.475973 | false | false | false | false |
scikit-learn/scikit-learn | sklearn/__check_build/__init__.py | 17 | 1702 | """ Module to give helpful messages to the user that did not
compile scikit-learn properly.
"""
import os
INPLACE_MSG = """
It appears that you are importing a local scikit-learn source tree. For
this, you need to have an inplace install. Maybe you are in the source
directory and you need to try from another location.... | bsd-3-clause | 8ec13c4ce998fb107f827d82d21da85c | 33.04 | 75 | 0.615159 | 4.033175 | false | false | false | false |
scikit-learn/scikit-learn | examples/decomposition/plot_pca_vs_fa_model_selection.py | 12 | 4535 | """
===============================================================
Model selection with Probabilistic PCA and Factor Analysis (FA)
===============================================================
Probabilistic PCA and Factor Analysis are probabilistic models.
The consequence is that the likelihood of new data can be u... | bsd-3-clause | a96cc6f0cb0299246154662a16d4e499 | 30.061644 | 87 | 0.654245 | 3.374256 | false | false | false | false |
scikit-learn/scikit-learn | sklearn/gaussian_process/tests/test_gpc.py | 12 | 9858 | """Testing for Gaussian process classification """
# Author: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
# License: BSD 3 clause
import warnings
import numpy as np
from scipy.optimize import approx_fprime
import pytest
from sklearn.gaussian_process import GaussianProcessClassifier
from sklearn.gaussian_proce... | bsd-3-clause | 1ce0794e84a68d65edd39f0668cb549d | 33.468531 | 88 | 0.649523 | 3.36221 | false | true | false | false |
scikit-learn/scikit-learn | examples/svm/plot_svm_kernels.py | 13 | 1970 | # -*- coding: utf-8 -*-
"""
=========================================================
SVM-Kernels
=========================================================
Three different types of SVM-Kernels are displayed below.
The polynomial and RBF are especially useful when the
data-points are not linearly separable.
"""
# Co... | bsd-3-clause | f47e3a130ac11a77e04024d532e01998 | 19.946809 | 85 | 0.485018 | 2.723375 | false | false | false | false |
scikit-learn/scikit-learn | examples/linear_model/plot_sgd_iris.py | 12 | 1947 | """
========================================
Plot multi-class SGD on the iris dataset
========================================
Plot decision surface of multi-class SGD on iris dataset.
The hyperplanes corresponding to the three one-versus-all (OVA) classifiers
are represented by the dashed lines.
"""
import numpy as... | bsd-3-clause | 38caa5ae404343dc4d6445df0d5b7668 | 22.178571 | 75 | 0.639959 | 3.120192 | false | false | false | false |
scikit-learn/scikit-learn | sklearn/neural_network/_base.py | 12 | 6330 | """Utilities for the neural network modules
"""
# Author: Issam H. Laradji <issam.laradji@gmail.com>
# License: BSD 3 clause
import numpy as np
from scipy.special import expit as logistic_sigmoid
from scipy.special import xlogy
def inplace_identity(X):
"""Simply leave the input array unchanged.
Parameters... | bsd-3-clause | d33856e43386cba54abc8c1938093098 | 25.708861 | 79 | 0.630332 | 3.829401 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.