Saravanan666/pypi-org huggingface dataset:
Package: numpy-linreg
numpy-linregLinear Regression with numpy only.InstallationThenumpy-linreggit repois available asPyPi packagepipinstallnumpy-linregpipinstallgit+ssh://git@github.com/ulf1/numpy-linreg.gitUsageRidge Regressionimportnumpy_linreg.ridgeasridgeimportnumpy_linreg.metricsasmetricsbeta=ridge.lu(y,X)rmse=metrics.rmse(y,X,beta)OLS Regressionimportnumpy_linreg.olsasolsbeta=ols.lu(y,X)beta=ols.pinv(y,X)beta=ols.qr(y,X)beta=ols.svd(y,X)Check theexamplesfolder for notebooks.AppendixCommandsInstall a virtual environmentpython3.6-mvenv.venvsource.venv/bin/activatepip3install--upgradepippip3install-rrequirements.txtpip3install-rrequirements-dev.txtpip3install-rrequirements-demo.txt(If your git repo is stored in a folder with whitespaces, then don’t use
the subfolder.venv. Use an absolute path without whitespaces.)Python commandsJupyter for the examples:jupyter labCheck syntax:flake8--ignore=F401--exclude=$(grep-v'^#'.gitignore | xargs | sed-e's//,/g')PublishpandocREADME.md--frommarkdown--torst-s-oREADME.rstpythonsetup.pysdisttwineupload-rpypidist/*Clean upfind . -type f -name "*.pyc" | xargs rm
find . -type d -name "__pycache__" | xargs rm -r
rm -r .pytest_cache
rm -r .venvSupportPleaseopen an
issuefor support.ContributingPlease contribute usingGithub
Flow. Create a branch,
add commits, andopen a pull
request.
Package: numpymaxflow
numpymaxflow: Max-flow/Min-cut in numpy for 2D images and 3D volumesNumpy-based implementation of Max-flow/Min-cut based on the following paper:Boykov, Yuri, and Vladimir Kolmogorov. "An experimental comparison of min-cut/max-flow algorithms for energy minimization in vision." IEEE transactions on pattern analysis and machine intelligence 26.9 (2004): 1124-1137.If you want same functionality in PyTorch, then considerPyTorch-based implementationCitationIf you use this code in your research, then please consider citing:Asad, Muhammad, Lucas Fidon, and Tom Vercauteren."ECONet: Efficient Convolutional Online Likelihood Network for Scribble-based Interactive Segmentation."Medical Imaging with Deep Learning (MIDL), 2022.Installation instructionspip install numpymaxflowor# Clone and install from github repo

$ git clone https://github.com/masadcv/numpymaxflow
$ cd numpymaxflow
$ pip install -r requirements.txt
$ python setup.py installExample outputsMaxflow2dInteractive maxflow2dExample usageThe following demonstrates a simple example showing numpymaxflow usage:image=np.asarray(Image.open('data/image2d.png').convert('L'),np.float32)image=np.expand_dims(image,axis=0)prob=np.asarray(Image.open('data/image2d_prob.png'),np.float32)lamda=20.0sigma=10.0post_proc_label=numpymaxflow.maxflow(image,prob,lamda,sigma)For more usage examples see:2D and 3D maxflow and interactive maxflow examples:demo_maxflow.pyReferencesOpenCV's Graphcut implementationSimpleCRF's maxflow implementationtorchmaxflow's implementationThis repository depends on the code formaxflow from latest version of OpenCV, which has been included.
Package: numpy-minmax
numpy-minmax: a fast function for finding the minimum and maximum value in a NumPy arrayNumPy lacked an optimized minmax function, so we wrote our own. At Nomono, we use it for audio processing, but it can be applied any kind of float32 ndarray.Written in C and takes advantage of AVX for speedRoughly2.3x speedupcompared to the numpy amin+amax equivalent (tested on Intel CPU with numpy 1.24-1.26)The fast implementation is tailored for float32 arrays that are C-contiguous, F-contiguous or 1D strided. Strided arrays with ndim >= 2 get processed with numpy.amin and numpy.amax, so no perf gain there.Installation$ pip install numpy-minmaxUsageimportnumpy_minmaximportnumpyasnparr=np.arange(1337,dtype=np.float32)min_val,max_val=numpy_minmax.minmax(arr)# 0.0, 1336.0ChangelogSeeCHANGELOG.mdDevelopmentInstall dev/build/test dependencies as denoted in setup.pyCC=clang pip install -e .pytestRunning benchmarksInstall diplibpip install diplibpython scripts/perf_benchmark.pyAcknowledgementsThis library is maintained/backed byNomono, a Norwegian audio AI startup.
Package: numpy-mips64
It provides:a powerful N-dimensional array objectsophisticated (broadcasting) functionstools for integrating C/C++ and Fortran codeuseful linear algebra, Fourier transform, and random number capabilitiesand much moreBesides its obvious scientific uses, NumPy can also be used as an efficient
multi-dimensional container of generic data. Arbitrary data-types can be
defined. This allows NumPy to seamlessly and speedily integrate with a wide
variety of databases.All NumPy wheels distributed on PyPI are BSD licensed.
Package: numpy-mkl
NumPy is a general-purpose array-processing package designed to
efficiently manipulate large multi-dimensional arrays of arbitrary
records without sacrificing too much speed for small multi-dimensional
arrays.  NumPy is built on the Numeric code base and adds features
introduced by numarray as well as an extended C-API and the ability to
create arrays of arbitrary type which also makes NumPy suitable for
interfacing with general-purpose data-base applications.There are also basic facilities for discrete fourier transform,
basic linear algebra and random number generation.
Package: numpy-mkp2020
NumPy is a general-purpose array-processing package designed to
efficiently manipulate large multi-dimensional arrays of arbitrary
records without sacrificing too much speed for small multi-dimensional
arrays.  NumPy is built on the Numeric code base and adds features
introduced by numarray as well as an extended C-API and the ability to
create arrays of arbitrary type which also makes NumPy suitable for
interfacing with general-purpose data-base applications.There are also basic facilities for discrete fourier transform,
basic linear algebra and random number generation.All numpy wheels distributed from pypi are BSD licensed.Windows wheels are linked against the ATLAS BLAS / LAPACK library, restricted
to SSE2 instructions, so may not give optimal linear algebra performance for
your machine. Seehttp://docs.scipy.org/doc/numpy/user/install.htmlfor
alternatives.
Package: numpy-nn
numpy_nnNumpy NN is a Deep Neural Network Package which is built on base Numpy operations. This project is under development and any contributions are welcome.Free software: MIT licenseDocumentation:https://numpy-nn.readthedocs.io.FeaturesLayers: (Neurons)Losses: (Mean Absolute Error, Mean Squared Error, Binary Cross Entropy, Cross Entropy)Optimizer: (Stochastic Gradient Descent, RMSProp, Adam, Momentum)Activation: (ReLU, TanH, Sigmoid, LeakyReLU. ELU, Softmax)Layer Abstraction to implement custom activations and layersPersist model for later reuse.TODOImplementation of different LossesDistributed Computation or GPU utilizationDataset processing utilitiesCreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.1.0 (2020-05-10)First release on PyPI.
Package: numpy-onlinestats
numpy-onlinestatsThis is a Python package for element-wise streaming statistics of Numpy arrays, meaning that arrays can be added one-by-one.
This is much more memory-efficient than first collecting all arrays before calculating statstics.
One major usecase is Bayesian modeling, where the posterior distribution is often intractable and can only be approximated via sampling.
This concerns both MCMC and variational inference meethods. MCMC is inherently sampling-based, while variational inference methods can have derived quantities or structured posteriors that do not admit closed-form expressions for properties of their distribution.numpy-onlinestats approximates quantiles and cumulative distribution functions using thet-digest algorithm(in particular, it usesthis implementation) and calculates exact moments using anumerically stable algorithm.RequirementsPython 3.10 or newerA C++20 compatible compiler (developed with GCC 13 using-std=c++20)Sample codeimportnumpyasnpimportnumpy_onlinestatsasnpostats=npo.NpOnlineStats(np.random.uniform((5,3,7)))foriinrange(100):stats.add(np.random.uniform((5,3,7)))stats.quantile(0.25)stats.mean()stats.var()
Package: numpy-ops1234567890
FoobarFoobar is a Python library for dealing with word pluralization.InstallationUse the package managerpipto install foobar.pipinstallfoobarUsageimportfoobar# returns 'words'foobar.pluralize('word')# returns 'geese'foobar.pluralize('goose')# returns 'phenomenon'foobar.singularize('phenomena')ContributingPull requests are welcome. For major changes, please open an issue first
to discuss what you would like to change.Please make sure to update tests as appropriate.LicenseMIT
Package: numpy-partition
Split numpy arrays into partitions by one or multiple columns and apply window function to each partition.This module tries to replicateselect window_function() over (partition by ... order by ...) ...functionality, commonly found in SQL databases.The following window functions are available out of the box:row_number(),top(),avg().Usage examples:>>> from partition import apply_over_partition
    >>> from partition.window import row_number, top, avg

    >>> data = np.array([[1,1,3], [2,2,3], [1,1,4]], dtype=np.float32)
    >>> partition_by_col_indexes = (0, 1)
    >>> value_col_indexes = (2,)
    >>> value_ordering = (-1,)  # descending order
    >>> f = avg
    >>> f_kwargs = dict(vcol=2, top_n=2)
    >>> apply_over_partition(data=data, partition_by_col_indexes=partition_by_col_indexes, value_col_indexes=value_col_indexes, value_ordering=value_ordering, f=f, f_kwargs=f_kwargs)
    array([3.5, 3. , 3.5])

    >>> f = avg
    >>> f_kwargs = dict(vcol=2, top_n=1)
    >>> apply_over_partition(data=data, partition_by_col_indexes=partition_by_col_indexes, value_col_indexes=value_col_indexes, value_ordering=value_ordering, f=f, f_kwargs=f_kwargs)
    array([4., 3., 4.])

    >>> f = row_number
    >>> f_kwargs = dict()
    >>> apply_over_partition(data=data, partition_by_col_indexes=partition_by_col_indexes, value_col_indexes=value_col_indexes, value_ordering=value_ordering, f=f, f_kwargs=f_kwargs)
    array([1, 0, 0])

    >>> f = top
    >>> f_kwargs = dict(n=1)
    >>> apply_over_partition(data=data, partition_by_col_indexes=partition_by_col_indexes, value_col_indexes=value_col_indexes, value_ordering=value_ordering, f=f, f_kwargs=f_kwargs)
    array([False,  True,  True])
Package: numpyprint
NumpyPrintNumpyprint uses the Package prettytable to print numpy arrays in a nice format. At the moment this works well until a 2D Dimension.Installationpipinstallnumpyprint

or

python3-mpipinstallnumpyprintWhat is itNumpyPrint nicely prints an numpy array with the help of the package PrettyTable. It prints arrays of any dimension.Exampleimportnumpyasnpfromnumpyprintimportnp_printnumpy_array=np.random.rand(1,2,3)*100np_print(numpy_array)The output with the default settings looks like this:+---+----------------------------+---------------------------+|0|+---+--------------------+|+---+-------------------+||||0|40.361415789985486|||0|89.54304456427288|||||1|42.44964170184573|||1|43.11298502039822|||||2|19.234562477482196|||2|40.0682288789328||||+---+--------------------+|+---+-------------------+|+---+----------------------------+---------------------------+It prints a nice table with frame boarders and row numbers.How to use itPrint to Consoleimportnumpyasnpimportnumpyprintasnpparray=np.random.rand(3,2,3)*100npp.np_print(array)# or with change of some settingsnpp.np_print(array,precision=2,row_numbers=True,column_numbers=True,odd_vertical=False,style='plain')Use it in Jupyter NotebooksIn Jupyter Notebook it is possible to use HTML to format the output. The following command prints the numpy array in a nice table.importnumpyasnpimportnumpyprintasnpparray=np.random.rand(3,2)npp.np_display(array)Get the PrettyTable ObjectIf you want the PrettyTable object you can usenp_format(). But keep in mind that multidimensional arrays have nested tables.importnumpyasnpimportnumpyprintasnpparray=np.random.rand(3,2)table=npp.np_format(array)Change the Default SettingsThe defaults/settings are:defaults=dict({'row_numbers':True,'column_numbers':False,'precision':None,# None or int like 2'style':'default',# 'default' or 'plain''odd_vertical':True})It is possible to change it like:importnumpyasnpimportnumpyprintasnppnpp.defaults['precision']=2
Package: numpy-ringbuffer
numpy_ringbufferRing (aka circular) buffers backed by a numpy array, supporting:Operations fromcollections.dequeb.append(val)b.appendleft(val)b.extend(val)b.extendleft(val)b.pop(val)b.popleft(val)Thecollections.Sequenceprotocol (unoptimized)C-side unwrapping into an array withnp.array(b)Arbitrary element dtypes, including extra dimensions likeRingBuffer(N, dtype=(int, 3))For example:importnumpyasnpfromnumpy_ringbufferimportRingBufferr=RingBuffer(capacity=4,dtype=np.bool)r.append(True)r.appendleft(False)print(np.array(r))# array([False, True])
Package: numpy-serializer
numpy-serializerMotivationI couldn't find a nice high-level package that is fast enough to serialize and deserialize numpy arrays while preserving the type
and shape informations.Installationpip install numpy-serializerHow to useimportnumpy_serializerasnsimportnumpyasnpa=np.random.normal(size=(50,120,150))b=ns.to_bytes(a)c=ns.from_bytes(b)assertnp.array_equal(a,c)LicenseThis project is licensed under the GPL-3 license.
Package: numpyslicesplit
Splits a numpy array or a list based on the given indices or ranges and returns the split arrays.pip install numpyslicesplitTested against Windows 10 / Python 3.11 / AnacondaHow to use it in PythonParameters:a(numpyarray/list):Theinputarray/listtobesplit.splits(list):Theindicesorrangestosplitthearrayon.delete(bool,optional):IfTrue,removesthespecifiedindicesfromthesplitarrays,ifnotitkeepsthemanddeletestheothersDefaultstoTrue.Returns:list:Alistofnumpyarrayssplitbasedonthegivenindicesorranges.Example:fromnumpyslicesplitimportnp_slice_splita=np.arange(1000).reshape(100,10)[...,0]splits=[(3,5),(9,14),(24,30),(41,43)]s1=np_slice_split(a,splits,delete=True)print(f"{s1=}")s2=np_slice_split(a,splits,delete=False)print(f"{s2=}")splits=[3,4,5,65,7,4,6,63,2,5,(0,10)]s1=np_slice_split(a.tolist(),splits,delete=True)print(f"{s1=}")s2=np_slice_split(a.tolist(),splits,delete=False)print(f"{s2=}")# s1=[array([ 0, 10, 20]), array([50, 60, 70, 80]),#     array([140, 150, 160, 170, 180, 190, 200, 210, 220, 230]),#     array([300, 310, 320, 330, 340, 350, 360, 370, 380, 390, 400]),#     array([430, 440, 450, 460, 470, 480, 490, 500, 510, 520, 530, 540, 550,#        560, 570, 580, 590, 600, 610, 620, 630, 640, 650, 660, 670, 680,#        690, 700, 710, 720, 730, 740, 750, 760, 770, 780, 790, 800, 810,#        820, 830, 840, 850, 860, 870, 880, 890, 900, 910, 920, 930, 940,#        950, 960, 970, 980, 990])]# s1=[[100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230,# 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 360, 370, 380# , 390, 400, 410, 420, 430, 440, 450, 460, 470, 480, 490, 500,# 510, 520, 530, 540, 550, 560, 570, 580, 590, 600, 610, 620],#  [640], [660, 670, 680, 690, 700, 710, 720, 730, 740, 750, 760,#  770, 780, 790, 800, 810, 820, 830, 840, 850, 860, 870, 880, 890,#  900, 910, 920, 930,# 940, 950, 960, 970, 980, 990]]# s2=[[0, 10, 20, 30, 40, 50, 60, 70, 80, 90], [630], [650]]
Package: numpysocket
NumpySocketAboutProvides a subclass ofsocket.socketthat enables a TCP/IP socket that can send and recieve Numpy arrays with the same interface as a regular Pythonsocket.MethodsThe subclass ofsocket.socketprovides three key method overrides. All othersocketmethods are untouched.sendall- takes a Numpy array as an argument to send an Arrayrecv- outputs a Numpy array (len() == 0if no data received)Installationpip install numpysocketExamplesThere are two separate examples showing how to create a client and sever using aNumpySocketSimple./examples/Simpleshows aserverwhich closes after the client disconnects.In terminal 1, run:python simple_server.pyIn terminal 2, run:python simple_client.pyOpenCV./examples/OpenCVshows an actual usecase for this library (sending video frames). This example requires installing additional requirements (./examples/openCV/requirements.txt).This example also shows how to create a persistentserverwhich allows for new clients to connect after old clients disconnects.In terminal 1, run:python cv_server.pyIn terminal 2, run:python cv_client.pyKill terminal 2 and re-run the command and theserverwill allow for the new connection.
Package: numpyson
cross py2/py3 python object serializer, currently using and extending jsonpickle
to dump/load python objects with a primary focus on numpy/pandas types.The main purpose ofnumpysonis to allow dumping under a python3 interpreter
and loading under python2 and vice versa.  This is a use case that is not covered
by current serializers AFAIK.quick simple API example:import numpyson
import numpy
s = numpyson.dumps(numpy.array([1,2,3]))
data = numpyjson.loads(s)
assert data.to_list() == [1,2,3]Currently supported:numpy arraysand some other numpy typespandas.TimeSeriespandas.DataFramepandas.DateTimeIndexpandas.Int64Indexpandas.Float64Indexpandas.Indexnested python data structures with the above types0.4fix bug: respect ordering when serializing/deserializing ndarrays0.3depend on pandas>=0.13.1 because we are using Float64Index which
does not exist in pandas-0.12support numpy.float64 and numpy.int64
Package: numpytypechecker
Check and convert the data type of a NumPy array based on a predefined set of data types.pip install numpytypecheckerTested against Windows / Python 3.11 / Anacondadtypecheck(array,filterna=True,float2int=True,dtypes=(np.uint8,np.int8,np.uint16,np.int16,np.uint32,np.int32,np.uint64,np.int64,np.uintp,np.intp,np.float16,np.float32,np.float64,'M','m','O','P','S','U','V','p','s',np.complex64,np.complex128,np.datetime64,np.timedelta64,np.void,bool,np.bool_,object)):r"""Check and convert the data type of a NumPy array based on a predefined set of data types.Parameters:- array (numpy.ndarray): Input NumPy array.- filterna (bool, optional): If True, remove NaN values from the array before type checking.Default is True.- float2int (bool, optional): If True, convert float arrays to integer if they contain only integers.Default is True.- dtypes (tuple, optional): Tuple of NumPy data types to check against. Default includes various numeric,datetime, timedelta, complex, boolean, and object types.Returns:- numpy.ndarray: NumPy array with the converted data type.Examples:from numpytypechecker import dtypecheckimport numpy as np# Examplea1D = np.array([1, 2, 3, 4])a2D = np.array([[1, 2], [3, 4]])a3D = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])b1 = np.array([2., 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9])b2 = np.array([[1., 1., 1., 0.],[1., 1., 0., 1.],[0., 0., -3., 0.],[0., 0., np.nan, -4.]])print(dtypecheck(a1D, filterna=True, float2int=True, ).dtype)print(dtypecheck(a2D, filterna=True, float2int=True, ).dtype)print(dtypecheck(a3D, filterna=True, float2int=True, ).dtype)print(dtypecheck(b1, filterna=True, float2int=True, ).dtype)print(dtypecheck(b2, filterna=False, float2int=True, ).dtype)# uint8# uint8# uint8# float64# float64
Package: numpy-unit
numpy-unitThis package provides a tool for scientific computing by keeping track of the unit when performing classical operations on a multi-dimensionnal array with (almost) no extra-cost comparing to the standard numpy array.TheArrayUnitclass supports every operation a numpy.ndarray can handle (because it is a derived class of numpy.ndarray) but the operators are overloaded in order to perform transformations on theUnitcontained in everyArrayUnit.Installpip install numpy-unitExamples>>>importnumpyasnp>>>fromnumpy_unitimportUnit,ArrayUnit>>>>>>m=Unit('m')>>>sm2=Unit('s',-2)>>>complex_unit=Unit({'my_unit':0.5,'€':1,'capita':2})*(sm2**0.5)/m>>>print(complex_unit)€·capita²·my_unit^0.5·m⁻¹·s⁻¹>>>>>>arr=np.linspace(1,10,10,dtype=float)>>>a=ArrayUnit(arr,m)>>>b=ArrayUnit(arr**2,sm2)>>>print(a,'\\n+\\n',1,'\\n=\\n',a+1)[1.2.3.4.5.6.7.8.9.10.]m+1=[2.3.4.5.6.7.8.9.10.11.]m>>>print(a,'\\n*\\n',b,'\\n=\\n',a*b)[1.2.3.4.5.6.7.8.9.10.]m*[1.4.9.16.25.36.49.64.81.100.]s⁻²=[1.8.27.64.125.216.343.512.729.1000.]m·s⁻²The following rules applied (where {op} is one of the following: [+,-,*,/,//,%]):ArrayUnit {op} Object returns an ArrayUnit with the same unit as the ArrayUnitObject {op} ArrayUnit returns an ArrayUnit with the same unit as the ArrayUnitArrayUnit {op} ArrayUnit returns an ArrayUnit combining the Unit of the 2 ArrayUnit or an ErrorAn Error might be raised only when two ArrayUnit are conflicting and that ArrayUnit.is_strict is set to True. Otherwise, it would print a warning.An ArrayUnit is equal to a numpy.ndarray if and only if their underlying arrays are equal (np.array_equal) and the Unit of the ArrayUnit is empty.DevelopmentDoc of the master branch onreadthedocs.io.FeaturesBasic unit system handling multiplication, division, modulo and powerArrayUnit wrapper for unit + ndarrayOperators on ArrayUnit (and their variantsr{op}andi{op})eq, neaddsubmultruediv, floordivmodpow (but notrpow)Basic ndarray functionmeanstd...conda release
Package: numpyworld
Numpy WorldDraw this world with numpy.We firmly believe once you can draw one picture with programming, you can also draw a series of that kind of pictures with programming too.Installationsudo pip3 install numpyworldUsagefromnumpyworldimportWorldwidth=1920height=1080world=World(width=width,height=height)world.disable_jupyter_notebook_mode()forxinrange(width):foryinrange(height):ifwidth/7*1<x<width/7*2:world.draw_a_point(x,y,(0,255,0))ifwidth/7*3<x<width/7*4:world.draw_a_point(x,y,(0,0,0))ifwidth/7*5<x<width/7*6:world.draw_a_point(x,y,(255,0,0))world.show()MoreJupyter-notebook Examples
Package: numpyx
A small package with fast numpy routines written in cythonDocumentationhttps://numpyx.readthedocs.ioInstallationpip install numpyxFunctions in this packageAll functions here are specialized for double arrays onlyShort-cut functionsThese functions are similar to numpy functions but are faster by
exiting out of a loop when one element satisfies the given conditionany_less_thanany_less_or_equal_thanany_greater_thanany_greater_or_equal_thanany_equal_toarray_is_sortedallequalminmax1dCalculate min. and max. value in one gosearchsorted1like search sorted, but for 1d double arrays. It is faster than the more generic numpy versionsearchsorted2like search sorted but allows to search across any column of a 2d arraynearestidxReturn the index of the item in an array which is nearest to a given value. The
array does not need to be sorted (this is a simple linear search)nearestitemFor any value of an array, search the nearest item in another array and put its
value in the output resultweightedavgWeighted averageof a time-seriestrapztrapz integration specialized for contiguous / double arrays. Quite faster than generic numpy/scipy