Saravanan666/pypi-org huggingface dataset:
Package: numbits
numbitsPack and unpack 1, 2 and 4 bit data to/from 8-bit numpy arraysMotivated by radio astronomy, where low bitwidths are common.Project built withpybind11. Pack/unpack code based onsigpyproc.InstallationOn Unix (Linux, OS X)You can either:Install numbits from PyPI with:pipinstallnumbitsor you can:Clone this repository. and then:Build shared object .so locally, using:pythonsetup.pybuild_ext-iOr install the package globally, using:python-mpipinstall.or:pythonsetup.pyinstallTest callimportnumpyasnpimportnumbitsa=np.array([0,1,2,3,4,5,6,7,8],dtype='uint8')b=numbits.unpack(a,nbits=2)>>>array([0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,3,0,0,1,0,0,0,1,1,0,0,1,2,0,0,1,3,0,0,2,0],dtype=uint8)
Package: numbsql
Put some Numba in your SQLiteFair WarningThis library does unsafe things like pass around function pointer addresses
as integers.Use at your own risk.If you're unfamiliar with why passing function pointers' addresses around as
integers might be unsafe, then you shouldn't use this library.RequirementsPython>=3.7numbaUsenix-shellfrom the repository to avoid dependency hell.Installationpoetry installExamplesScalar FunctionsThese are almost the same as decorating a Python function withnumba.jit.fromtypingimportOptionalfromnumbsqlimportsqlite_udf@sqlite_udfdefadd_one(x:Optional[int])->Optional[int]:"""Add one to `x` if `x` is not NULL."""ifxisnotNone:returnx+1returnNoneAggregate FunctionsThese follow the API of the Python standard library'ssqlite3.Connection.create_aggregatemethod. The difference with numbsql
aggregates is that they require two decorators:numba.experimental.jit_classandnumbsql.sqlite_udaf. Let's define theavg(arithmetic mean) function for
64-bit floating point numbers.fromtypingimportOptionalfromnumba.experimentalimportjitclassfromnumbsqlimportsqlite_udaf@sqlite_udaf@jitclassclassAvg:total:floatcount:intdef__init__(self):self.total=0.0self.count=0defstep(self,value:Optional[float])->None:ifvalueisnotNone:self.total+=valueself.count+=1deffinalize(self)->Optional[float]:ifnotself.count:returnNonereturnself.total/self.countWindow FunctionsYou can also define window functions for use with SQLite'sOVERconstruct:fromtypingimportOptionalfromnumba.experimentalimportjitclassfromnumbsqlimportsqlite_udaf@sqlite_udaf@jitclassclassWinAvg:# pragma: no covertotal:floatcount:intdef__init__(self)->None:self.total=0.0self.count=0defstep(self,value:Optional[float])->None:ifvalueisnotNone:self.total+=valueself.count+=1deffinalize(self)->Optional[float]:count=self.countifcount:returnself.total/countreturnNonedefvalue(self)->Optional[float]:returnself.finalize()definverse(self,value:Optional[float])->None:ifvalueisnotNone:self.total-=valueself.count-=1Calling your aggregate functionSimilar to scalar functions, we register the function with asqlite3.Connectionobject:>>>importsqlite3>>>fromnumbsqlimportcreate_aggregate,create_function>>>con=sqlite3.connect(":memory:")>>>create_function(con,"add_one",1,add_one)>>>con.execute("SELECT add_one(1)").fetchall()[(2,)]
Package: numcat
NumcatA Package to concatenate floating point numbers under a set of rules.InstallationRunpip install numcatin your command prompt.Usagefromnumcatimportfunctionsprint(functions.concat(1.1,1.2))Rules & DefintionConcatenation is the action of appending two or more objects end-to-end
to result in one singular number.The fractional and integer parts are concatenated independently to one another
for example: '1.1' concatenate '1.2' equals '11.12'
Package: numcertain
This package provides a python and numpy data type (uncertain) which implements a
floating point value with quantified uncertainity, allowing for forward uncertainity
propagation of uncorrelated values.PyPIpip install numcertainSource codehttps://github.com/DiamondLightSource/numcertainDocumentationhttps://DiamondLightSource.github.io/numcertainReleaseshttps://github.com/DiamondLightSource/numcertain/releasesAritmatic ExamplesA brief example of arithmatic with the provided uncertain data type is presented below:a=uncertain(42.0,5.0)b=uncertain(36,12)print(a+b)print(a-b)print(a*b)print(a/b)>> 78.0±13.0
>> 6.0±13.0
>> 1512.0±535.1784749034662
>> 1.1666666666666667±0.41294635409218067A brief example of arithmatic with numpy arrays with the uncertain dtype is presented
below:a=array([uncertain(5.0,3.0),uncertain(7.0,6.0)])b=array([uncertain(12.0,4.0),uncertain(24.0,8.0)])print(a+b)print(a-b)print(a*b)print(a/b)>> [uncertain(17.0, 5.0) uncertain(31.0, 10.0)]
>> [uncertain(-7.0, 5.0) uncertain(-17.0, 10.0)]
>> [uncertain(60.0, 41.182520563948) uncertain(168.0, 154.50566332662373)]
>> [uncertain(0.4166666666666667, 0.2859897261385278) uncertain(0.2916666666666667, 0.268238998830944)]Alternative MethodsIn order to accurately propagate uncertainties of related values the derivative of the
computed expectation must be known with respect to expectations it is comprised of.
Automatic differentiation (autodiff) provides a mechanism for computing the derivative
of arbitrary functions with respect to their components by exploiting the fact that all
codes, regardless of complexity, are reduced to a sequence of primative arithmetic
operations during execution for which the derivatives are known, by applying the chain
rule the overall derivative can be determined automatically.The python packageUncertaintiesprovides a python data type which performs autodiff
to propagate the corresponding uncertainity, unforunately due to Implementation as a
python object the library is non-performant when used for array math.WhilstPropagation of Uncertainty with autodiff, describes the use of autodiff
provided by the python packageJAXin propagating uncertainities for array math.Seehttps://DiamondLightSource.github.io/numcertainfor more detailed documentation.
Package: numcompress
numcompressSimple way to compress and decompress numerical series & numpy arrays.Easily gets you above 80% compression ratioYou can specify the precision you need for floating points (up to 10 decimal points)Useful to store or transmit stock prices, monitoring data & other time series data in compressed string formatCompression algorithm is based ongoogle encoded polyline format. I modified it to preserve arbitrary precision and apply it to any numerical series. The work is motivated by usefulness oftime aware polylinebuilt byArjun AttamatHyperTrack.
After building this I came acrossarraysthat are much efficient than lists in terms memory footprint. You might consider using that over numcompress if you don't care about conversion to string for transmitting or storing purpose.Installationpip install numcompressUsagefromnumcompressimportcompress,decompress# Integers>>>compress([14578,12759,13525])'B_twxZnv_nB_bwm@'>>>decompress('B_twxZnv_nB_bwm@')[14578.0,12759.0,13525.0]# Floats - lossless compression# precision argument specifies how many decimal points to preserve, defaults to 3>>>compress([145.7834,127.5989,135.2569],precision=4)'Csi~wAhdbJgqtC'>>>decompress('Csi~wAhdbJgqtC')[145.7834,127.5989,135.2569]# Floats - lossy compression>>>compress([145.7834,127.5989,135.2569],precision=2)'Acn[rpB{n@'>>>decompress('Acn[rpB{n@')[145.78,127.6,135.26]# compressing and decompressing numpy arrays>>>fromnumcompressimportcompress_ndarray,decompress_ndarray>>>importnumpyasnp>>>series=np.random.randint(1,100,25).reshape(5,5)>>>compressed_series=compress_ndarray(series)>>>decompressed_series=decompress_ndarray(compressed_series)>>>seriesarray([[29,95,10,48,20],[60,98,73,96,71],[95,59,8,6,17],[5,12,69,65,52],[84,6,83,20,50]])>>>compressed_series'5*5,Bosw@_|_Cn_eD_fiA~tu@_cmA_fiAnyo@o|k@nyo@_{m@~heAnrbB~{BonT~lVotLoinB~xFnkX_o}@~iwCokuCn`zB_ry@'>>>decompressed_seriesarray([[29.,95.,10.,48.,20.],[60.,98.,73.,96.,71.],[95.,59.,8.,6.,17.],[5.,12.,69.,65.,52.],[84.,6.,83.,20.,50.]])>>>(series==decompressed_series).all()TrueCompression RatioTest# of NumbersCompression ratioIntegers10k91.14%Floats10k81.35%You can run the test suite with -s switch to see the compression ratio. You can even modify the tests to see what kind of compression ratio you will get for your own input.pytest -sHere's a quick example showing compression ratio:>>>series=random.sample(range(1,100000),50000)# generate 50k random numbers between 1 and 100k>>>text=compress(series)# apply compression>>>original_size=sum(sys.getsizeof(i)foriinseries)>>>original_size1200000>>>compressed_size=sys.getsizeof(text)>>>compressed_size284092>>>compression_ratio=((original_size-compressed_size)*100.0)/original_size>>>compression_ratio76.32566666666666We get ~76% compression for 50k random numbers between 1 & 100k. This ratio increases for real world numerical series as the difference between consecutive numbers tends to be lower. Think of stock prices, monitoring & other time series data.ContributeIf you see any problem, open an issue or send a pull request. You can write tomeatamit.juschill@gmail.com
Package: numcu
Numerical CUDA-based Python library built on top ofCuVec.Table of contentsInstallUsageContributingLicenceInstallRequirements:Python 3.7 or greater (e.g. viaAnaconda or Miniconda, or viapython3-dev)(optional)CUDA SDK/Toolkit(including drivers for an NVIDIA GPU)note that if the CUDA SDK/Toolkit is installedafterNumCu, then NumCu must be re-installed to enable CUDA supportpipinstallnumcuUsageSeethe usage documentation.ContributingSeeCONTRIBUTING.md.LicenceCopyright:Casper O. da Costa-LuisContributors
Package: numdata
NumData DocumentationInstallationnumdata can be installed using python pip. The package is hosted onPYPIandPYPI-testpipinstallnumdataUsageInitialization is not required for using methods in numdatafromnumdataimportcalculate# Calculate square of a numberprint(calculate.calculateSquare(8))# 64# Calculate cube of a numberprint(calculate.calculateCube(8))# 512
Package: numdatapiyumiyu
#Test
##Testsudo python setup.py install
python3 -m pip install --user --upgrade setuptools wheel
sudo python3 setup.py sdist bdist_wheelInstall to to upload to pypi:
python3 -m pip install --user -upgrade twine
twine upload --repository-urlhttps://test.pypi.org/legacydist/*or
python3 -m twine upload --repository-urlhttps://test.pypi.org/legacydist/*
Package: numdatasalva
NUmData DocumentationInstallationnumdata can be installed uing python pip. The package is hosted onPypiandtest.PypiUsageInitialization is not required for using methods in numdatafromnumdataimportcalculate# calculate square of a numberprint(calculate.calculateSquare(3))# 9# calculate cube of a numberprint(calculate.calculateSquare(3))# 27
Package: numdatasmexample
NumData DocumentationInstallationnumdata can be installed using python pip. The package is hosted onPYPIandPYPI-testpipinstallnumdataUsageInitialization is not required for using methods in numdatafromnumdataimportcalculate# Calculate square of a numberprint(calculate.calculateSquare(8))# 64# Calculate cube of a numberprint(calculate.calculateCube(8))# 512
Package: numdoclinter
numdoclinterInspired bynumdoclint,
but wanting to try a slightly different approach...Specifically, instead of trying to parse signatures and docstrings using
regex,numdoclinteruses the abstract syntax tree built into Python's
standard libraryastpackage.Basically, all we do is:recurse through folders to parse modules and list functions,parse function signatures and type annotations,parse function docstrings,check that the signature and docstring are consistent and contain
everything required.You can clone this repo and thenpip installit, and then you can runnumdoclinter(or justndlinter) from your command line on whatever
folder you like.git clone https://github.com/peterprescott/numdoclinter
cd numdoclinter
pip install .
ndlinter --help
Package: num-dual
num-dualGeneralized, recursive, scalar and vector (hyper) dual numbers for the automatic and exact calculation of (partial) derivatives.
Including bindings for python.Installation and UsagePythonThe python package can be installed directly from PyPI:pip install num_dualRustAdd this to yourCargo.toml:[dependencies]num-dual="0.7"ExamplePythonCompute the first and second derivative of a scalar-valued function.fromnum_dualimportsecond_derivativeimportnumpyasnpdeff(x):returnnp.exp(x)/np.sqrt(np.sin(x)**3+np.cos(x)**3)f,df,d2f=second_derivative(f,1.5)print(f'f(x)    ={f}')print(f'df/dx   ={df}')print(f'd2f/dx2 ={d2f}')RustThis example defines a generic function that can be called using any (hyper) dual number and automatically calculates derivatives.usenum_dual::*;fnf<D:DualNum<f64>>(x:D,y:D)->D{x.powi(3)*y.powi(2)}fnmain(){let(x,y)=(5.0,4.0);// Calculate a simple derivative using dual numbersletx_dual=Dual64::from(x).derivative();lety_dual=Dual64::from(y);println!("{}",f(x_dual,y_dual));// 2000 + [1200]ε// or use the provided function insteadlet(_,df)=first_derivative(|x|f(x,y.into()),x);println!("{df}");// 1200// Calculate a gradientlet(value,grad)=gradient(|v|f(v[0],v[1]),SMatrix::from([x,y]));println!("{value} {grad}");// 2000 [1200, 1000]// Calculate a Hessianlet(_,_,hess)=hessian(|v|f(v[0],v[1]),SMatrix::from([x,y]));println!("{hess}");// [[480, 600], [600, 250]]// for x=cos(t) and y=sin(t) calculate the third derivative w.r.t. tlet(_,_,_,d3f)=third_derivative(|t|f(t.cos(),t.sin()),1.0);println!("{d3f}");// 7.358639755305733}DocumentationYou can find the documentation of the rust cratehere.The documentation of the python package can be foundhere.PythonFor the following commands to work you have to have the package installed (see: installing from source).cd docs
make htmlOpen_build/html/index.htmlin your browser.Further readingIf you want to learn more about the topic of dual numbers and automatic differentiation, we have listed some useful resources for you here:Initial paper about hyper-dual numbers:Fike, J. and Alonso, J., 2011Website about all topics regarding automatic differentiation:autodiff.orgOur paper about dual numbers in equation of state modeling:Rehner, P. and Bauer, G., 2021Cite usIf you findnum-dualuseful for your own scientific studies, considerciting our publicationaccompanying this library.@ARTICLE{rehner2021,
    AUTHOR={Rehner, Philipp and Bauer, Gernot},
    TITLE={Application of Generalized (Hyper-) Dual Numbers in Equation of State Modeling},
    JOURNAL={Frontiers in Chemical Engineering},
    VOLUME={3},
    YEAR={2021},
    URL={https://www.frontiersin.org/article/10.3389/fceng.2021.758090},
    DOI={10.3389/fceng.2021.758090},
    ISSN={2673-2718}
}
Package: numeph
Author:Behrouz SafariLicense:MITnumephConvert JPL SPK ephemeris to numpy arrayInstallationInstall the latest version ofnumephfromPyPI:pip install numephRequirements arenumpyandjplephemSave some segments of 'de440s.bsp' from 2020 to 2030:fromdatetimeimportdatetimefromnumephimportSPKt1=datetime(2020,1,1)t2=datetime(2030,1,1)spk=SPK(fname='de440s.bsp',t1=t1,t2=t2,segs_tup=[(0,10),(0,3),(3,399),(3,301)])# save as txt filespk.to_txt('de440s_2020_2030.txt')# save as picklespk.to_pickle('de440s_2020_2030.pickle')Load .txt or .pickle files:You can load the above saved files usingload_txtandload_picklefunctions. The will return a dictionary of Segment objects.fromnumephimportload_txtdc=load_txt('de440s_2020_2030.txt')To access each segment, pass the (center, target) tuple as dictionary key.seg=dc[(3,301)]get position of an object from a segment:t=datetime.utcnow()pos=seg.get_pos(t)See more atastrodatascience.net
Package: numeprimos
Este paquete contiene una funciÃ³n que calcula y presenta los nÃºmeros primos que hay entre el 1 y nÃºmero pasado como parÃ¡metro.This program is free software: You can redistribute it and/or modify it under the terms of license by the Free Software Foundation, either version 3 of the License(at your option) any other version.
Package: numequate
Numequate Math Functions LibraryThenumequatelibrary provides basic mathematical operations for addition, subtraction, multiplication, division, and exponentiation.InstallationYou can install the library using pip:pipinstallnumequateAboutThenumequatelibrary is a collection of basic mathematical operations for Python. It's designed to simplify common mathematical tasks in your Python projects. Whether you need to perform addition, subtraction, multiplication, division, or exponentiation,numequatehas you covered.FeaturesSimplicity:The library provides straightforward functions for essential math operations.Error Handling:It includes error handling to ensure safe division and handling of edge cases.Additional Functions:In addition to basic operations,numequateoffers extra math functions, including factorial, Fibonacci, and GCD calculations.Range Manipulation:Functions likeclampandmap_rangehelp you manage values within specific ranges.Interpolation:Perform linear interpolation with thelerpfunction.Math Expressions:Evaluate mathematical expressions with themathfunction.DocumentationFor detailed information on how to use each function and examples, please refer to thedocumentation.Usagefromnumequate.baseimportadd,subtract,multiply,divide,powerresultAdd=add(5,3)# Returns 8#result = subtract(10, 4) # Returns 6#result = multiply(2, 6)  # Returns 12#result = divide(10, 2)   # Returns 5resultPower=power(3,4)# Returns 81print(resultAdd,resultPower)Functionsadd(a, b)Adds two numbers a and b and returns the result.subtract(a, b)Subtracts the number b from a and returns the result.multiply(a, b)Multiplies two numbers a and b and returns the result.divide(a, b)Divides the number a by b and returns the result. Raises a ValueError if b is 0.power(base, exponent)Calculates the result of raising the base to the power of exponent.clamp(value, min_value, max_value)Clamps a value within the specified range.map_range(value, in_min, in_max, out_min, out_max)Maps a value from one range to another.lerp(start, end, alpha)Performs linear interpolation between two values.math(expression)Calculates the provided numbers and content.factorial(n)Finds the factorial of a chosen number.fibonacci(n)Calculate the nth Fibonacci number.gcd(a, b)Calculate the greatest common divisor (GCD) of two non-negative integers a and b.LicenseThis library is provided under the BSD License. Feel free to use and modify it according to your needs.
Package: numeraicb
A Keras callback that calculates your model’s consistency during training at
each epoch. The callback prints the consistency and also adds the consistency at
the end of each epoch to the training history under theconsistencykey.UsageHere is a usage example:import pandas as pd
from numeraicb import Consistency
from keras.models import Sequential
from keras.layers.core import Dense

train = pd.read_csv('numerai_training_data.csv')
tourn = pd.read_csv('numerai_tournament_data.csv')

validation = tourn[tourn.data_type == 'validation']

features = ['feature{}'.format(i) for i in range(1, 51)]

X = train[features].values
Y = train.target.values

X_validation = validation[features].values
Y_validation = validation.target.values

model = Sequential()
model.add(Dense(30, kernel_initializer='uniform', input_dim=X.shape[1], activation='relu'))
model.add(Dense(1, activation='sigmoid'))
model.compile(optimizer='adamax', loss='binary_crossentropy')

cb = Consistency(tourn)

# Now your models consistency will be printed at each epoch
history = model.fit(X, Y, callbacks=[cb], validation_data=(X_validation, Y_validation))

# Consistency is stored in the history as well
for epoch, consistency in enumerate(history.history['consistency']):
    print('consistency at epoch {}: {:.2%}'.format(epoch, consistency))
Package: numerai-compute-lite
compute-litebuild and releasepip install -r requirements.txt
# modify pyproject.toml version
python -m build  # this will generate dist dir
python -m twine upload dist/*  # upload to pypiusageimportjsonimportosimportpandasaspdimportnumerai_compute_liteasnclfromnumerapiimportNumerAPIfromlightgbmimportLGBMRegressorimportdotenvdotenv.load_dotenv()# loads API secrets from .env filenapi=NumerAPI()napi.download_dataset("v4/train.parquet")napi.download_dataset("v4/features.json")training_data=pd.read_parquet('v4/train.parquet')feature_set=[]withopen("v4/features.json","r")asf:feature_metadata=json.load(f)features=feature_metadata["feature_sets"]["small"]model=LGBMRegressor()model.fit(training_data[features],training_data['target'])targets=training_data.columns.str.startswith('target')model_id='08e77bbf-036c-4216-b2f7-f8ed4beb88e9'ncl.deploy(model_id,model,features,'requirements.txt')
Package: numerai-reports
Numerai ReportsCollection of reports about the numer.ai machine learning competition.This library was created to provide some reports and statistics about the
competition, like round summaries and payout summaries, but also tools to
analyze one's model performance. For now, all reports are pure numeric reports.All information is retrieved via numerai's API and converted to pandas
DataFrames, to make it easy to work with. This allows to create your own
reports on top.numerai_reportsalso caches API results to disk to limit the
amount of request and to speed-up report generation.If you encounter a problem or have suggestions, feel free to open an issue.Installationpip install --upgrade numerai_reportsUsage Examplefrom numerai_reports import reports
print(reports.medals_leaderboard())
print(reports.medals_leaderboard(orderby="gold"))
print(reports.payouts(["uuazed", "uuazed2"]))
Package: numeral
This Python library implements integer-to-numeral and numeral-to-integer
conversion for a variety of numeral representations, including:alphabetic representation, i.e. a, b, c, d, … for 0, 1, 2, 3, …Roman numbers, i.e. I, II, III, IV, … for 1, 2, 3, 4, …generic tokens set representation, i.e. !, @, !!, !@, … for 0, 1, 2, 3…
(given the tokens set {!,@}).The generic tokens set representation uses the least number of tokens for
representing a given integer, and uses an exponential-like notation similar to
base-n conversion, except that the first symbol is used.
The alphabetic representation is a special case of a generic tokens set
representation, where the latin alphabet is used as tokens set.
Upper/lower case conversion should be handled through Python built-ins.
All representation support negative values.Detailed documentation is available for all functions through docstrings.Of note, the Roman numbers support include:bothUnicodeandASCII-onlyrepresentationspartial support for large numbers via the so-called Apostrophus notation
(see:https://en.wikipedia.org/wiki/Roman_numerals#Apostrophus)additive-only or subtractive notationstoggleable forgiving/strict Roman number parsingrepresentation of zero
(see:https://en.wikipedia.org/wiki/Roman_numerals#Zero)negative numbers (with option to specify a custom negative sign)partial support for archaic/late forms
(see:https://en.wikipedia.org/wiki/Numerals_in_Unicode#Roman_numerals)InstallationThe recommended way of installing the software is throughPyPI:$pipinstallnumeralAlternatively, you can clone the source repository fromGitHub:$mkdirnumeral$cdnumeral$gitclonegit@github.com:norok2/numeral.git$pythonsetup.pyinstall(some steps may require additional permissions depending on your configuration)The software does not have additional dependencies beyond Python and its
standard library.It was tested with Python 2.7 and 3.5.
Other version were not tested.UsageThe following functions are defined:int2letterConvert a number to the least amount letters (within an alphabet).>>>int2letter(10)'k'>>>importstring# Common string operations>>>int2letter(10,string.ascii_letters)# using both lower and upper cases'aW'letter2intConvert a group of letters (within a given alphabet) to a number.>>>letter2int('aa')26int2tokensConvert a number to the least amount tokens (within a tokens set).>>>int2tokens(12,('!','@','#','$'))'#!'tokens2intConvert a group of tokens (within a given set) to a number.>>>tokens2int('#!',('!','@','#','$'))12int2romanConvert an integer to its corresponding Roman number representation.>>>int2roman(1666)# using dedicated unicode chars'ⅯⅮⅭⅬⅩⅥ'>>>int2roman(1666,only_ascii=True)# using only ASCII'MDCLXVI'roman2intConvert a string representation of a Roman number to integer.>>>int2roman('MDCLXVI')1666