Saravanan666/pypi-org huggingface dataset:
Package: sampleTowelStuff
Welcome to The Hitchhiker’s Guide to PackagingTowelStuffTowel StuffTowel Stuff provides such and such and so and so. You might find
it most useful for tasks involving <x> and also <y>. Typical usage
often looks like this:#!/usr/bin/env python

import towel_stuff.towel_location as ts_loc
import towel_stuff.towel_utils    as ts_utils

if not ts_utils.has_towel():
    print "Your towel is located:", ts_loc.where_is_my_towel()(Note the double-colon and 4-space indent formatting above.)Paragraphs are separated by blank lines.Italics,bold,
andmonospacelook like this.A SectionLists look like this:FirstSecond. Can be multiple lines
but must be indented properly.A Sub-SectionNumbered lists look like you’d expect:hi theremust be goingUrls arehttp://like.thisand links can be
writtenlike this.
Package: samplewatts
A sample Python projectA sample project that exists as an aid to thePython Packaging User
Guide'sTutorial on Packaging and Distributing
Projects.This project does not aim to cover best practices for Python project
development as a whole. For example, it does not provide guidance or tool
recommendations for version control, documentation, or testing.The source for this project is available here.Most of the configuration for a Python project is done in thesetup.pyfile,
an example of which is included in this project. You should edit this file
accordingly to adapt this sample project to your needs.This is the README file for the project.The file should use UTF-8 encoding and can be written usingreStructuredTextormarkdownwith the appropriatekey set. It will be used to generate the project webpage on PyPI and will be
displayed as the project homepage on common code-hosting services, and should be
written for that purpose.Typical contents for this file would include an overview of the project, basic
usage examples, etc. Generally, including the project changelog in here is not a
good idea, although a simple “What's New” section for the most recent version
may be appropriate.
Package: sample-ws-server
WS ServerDOCPlayground around websockets.Install using pip:pip install sample-ws-server$ ws_server -h
usage: __main__.py [-h] [--host HOST] [--port PORT] [--verbosity VERBOSITY]

optional arguments:
  -h, --help            show this help message and exit
  --host HOST           Server host
  --port PORT           Port to bind
  --verbosity VERBOSITY
                        Log level DEBUG|INFO|WARNING...
Package: samplex
samplexPackage of useful sampling algorithms written in MLX. We plan on exploring how a combination of unified memory (by exploiting GPU and CPU together) and auto-diff can be used to get highly efficient and robust sampling locally on your Mac.Please get in touch if you're interested in contributing (tedwards2412@gmail.comandnash.sabti@gmail.com)!InstallationpipinstallsamplexBasic UsageFor a full example, please see the examples folder. Here is the basic structure for linear regression:fromsamplex.sampleximportsamplexfromsamplex.samplersimportMH_Gaussian_sampler# First lets generate some datax=mx.linspace(-5,5,20)err=mx.random.normal(x.shape)y=b_true*x**2+m_true*x+c_true+err# Our target distribution is just a linedeflog_target_distribution(theta,data):m,c,b=thetax,y,sigma=datamodel=b*x**2+m*x+cresidual=y-modelreturnsum(-0.5*(residual**2/sigma**2))# The sampler assumes it gets a target distribution with a single input vector thetalogtarget=lambdatheta:log_target_distribution(theta,(x,y,err))# Here are the sampler settingsNwalkers=32Ndim=3Nsteps=10_000cov_matrix=mx.array([0.01,0.01,0.01])jumping_factor=1.0theta0_array=mx.random.uniform(mx.array([m_min,c_min,b_min]),mx.array([m_max,c_max,b_max]),(Nwalkers,Ndim),)# Firstly we instantiate a samplex class and then run!sampler=MH_Gaussian_sampler(logtarget)sam=samplex(sampler,Nwalkers)sam.run(Nsteps,theta0_array,cov_matrix,jumping_factor)Next Steps:Get NUTs/HMC runningGet Ensemble sampler running (emcee)Refine plottingAdd helper functions for variety of priorsTreating parameters with different update speedsAdd file of priors and include in target distributionInclude autocorrelation calculation for steps
Package: sample-zewei2
A sample project that exists as an aid to thePython Packaging User Guide’sTutorial on Packaging and Distributing
Projects.This projects does not aim to cover best practices for Python project
development as a whole. For example, it does not provide guidance or tool
recommendations for version control, documentation, or testing.This is the README file for the project.The file should use UTF-8 encoding and be written usingreStructuredText. It
will be used to generate the project webpage on PyPI and will be displayed as
the project homepage on common code-hosting services, and should be written for
that purpose.Typical contents for this file would include an overview of the project, basic
usage examples, etc. Generally, including the project changelog in here is not
a good idea, although a simple “What’s New” section for the most recent version
may be appropriate.
Package: samplings
Samplings=========A collection of sampling methods for machine learning implemented on numpy.Author: Sander WoodProvidesGamma sampling for controllable generationLocal temperature sampling with weightsNucleus sampling (top-p sampling)Top-k samplingRandom samplingHow to useAs you probably know, sampling means randomly picking the next token according
to its conditional probability distribution. In other words, given the same
probability distribution, you may get a different result each time. If you
want to get rid of this uncertainty, you can setseedto a fixed value.By default, all the functions insamplingsreturn the index of the next token.
However, you can ask them to return the modified probability distribution by setreturn_probsasTrue. Then, you can make further manipulations based on this
probability distribution.In addition to the probability distribution, most sampling methods require other
parameters for modifying the probability distribution to achieve desired results.
Please refer to the docstring of each function for details.About gamma samplingGamma sampling is a method of tuning probabilities of target tokens to achieve
controlling specific properties of the generated sequence. The basic assumption is
that some attributes of sequences are closely related to the frequencies of some tokens.
As long as the controllable attribute can be defined at the token level, prior knowledge
can be directly brought into the sampling process, allowing arbitrary models to support
customisable and controllable generation.
Package: sampling-utils
Sampling UtilsPython tools to sample randomly with dont pick closestnelements constraints.
Also contains a batch generator for the same to sample with replacement and with repeats if necessary.InstallationSimply install usingpippipinstallsampling_utilsUsageDont Pick Closestfromsampling_utilsimportsample_from_listsample_from_list([1,2,3,4,5,6,7,8],dont_pick_closest=2)You are guaranteed to get samples that are at leastdont_pick_closestapart#(in value, not in indices).
Here you will get samples wheresample-any_other_sampleis always greater than 2.For example, if 2 is picked, no other item in range [2+dont_pick_closestand 2-dont_pick_closest] will be pickedAnother example looped 5 times:for_inrange(5):sample_from_list([1,2,3,4,5,6,8,9,10,12,14],dont_pick_closest=2)# Output# [5, 10, 2, 14]# [9, 6, 14, 1]# [3, 8, 12]# [10, 3, 6, 14]# [2, 5, 8, 12]If 12 is sampled, sampling 10 and 14 are not allowed sincedont_pick_closestis 2.
In other words, ifnis sampled, then sampling anything from[n-dont_pick_closest, ... n-1, n , n+1, ... n+dont_pick_closest]is not allowed (if present in the list).#Will be called asdont_pick_closest rulehereafter.Number of samplesYou can also specify how many samples you want from the list usingnumber_of_samplesparameter.
By default, you get maximum possible samples (without replacement).for_inrange(5):sample_from_list([1,2,3,4,5,6,8,9,10,12,14],dont_pick_closest=2,num_samples=2)# Output# [8, 2]# [6, 3]# [12, 1]# [4, 10]# [9, 1]If you try to sample more than what's possible, you will get an error saying that it's not possible.Min and max samplesYou may want to just know how much you can sample from a given list obeying thedont_pick_closest rulefromsampling_utilsimportget_min_samples,get_max_samplesprint(get_min_samples([1,2,3,4,5,6,8,9,10,12,14],dont_pick_closest=2))print(get_max_samples([1,2,3,4,5,6,8,9,10,12,14],dont_pick_closest=2))# Output# Min 3# Max 4Sampling without replacement successively / Generating batches of samples for one epochIf you want to successively sample without replacement i.e. sample as many samples from the list without repeating,
you can usebatch_rand_generatoras shown below.
This is particularly useful to generate batches of data
until no more batches can be generated (equivalent to one epoch).fromsampling_utilsimportbatch_rand_generatorfromsampling_utilsimportget_batch_generator_elementsbatch_size=2brg=batch_rand_generator([1,2,3,4,5,6,8,9,10,12,14],batch_size=batch_size,dont_pick_closest=2)print(get_batch_generator_elements(brg,batch_size=batch_size))# Output# [[1, 4], [8, 5], [14, 3], [2, 6]]Notice that the elementswithin each batch obey thedont_pick_closest rule(e.g. 1 and 4 from batch 1)from different batches need not obey the rule(e.g. 4 and 5 from batch 1 and 2 respectively).ContributingPull requests are very welcome.Fork the repoCreate new branch with feature name as branch nameCheck if things work with a jupyter notebookRaise a pull requestLicencePlease see attachedLicence
Package: samplr
S A M P L R@samplris a tiny decorator that provides options for returning a subset of items from a list. It also prints useful information about this sampling process to the terminal for debugging.InstallationInstallsamplrusing pip:pipinstallsamplrUsageTo use, decorate a function that returns a list with@samplr(). For example:fromsamplrimportsamplr@samplr(count=3)defget_data():# ... code that returns a list of 10 items of data ...get_data()will now return a list containing just the first 3 items of the original return list, instead of all 100.The arguments ofsamplr()are:count(optional, default'all'): The number of items to return. This can be an integer or the string 'all'.Ifcountis a positive integer, the decorated function's returned list will be that length.Ifcountis 'all', all items will be returned.Ifcountis a negative integer that many items will be ommited from the returned list.Also note:Ifcount> len(original_list), count = 'all'Ifcount< -len(original_list), count = 0sample_type(optional, default'head'): The method for selecting the subset of items. The available options are:'head': Select the firstcountitems in the list.'tail': Select the lastcountitems in the list.'random': Sample a random subset ofcountitems from the list.expand(optional, defaultTrue): Whether to expand each item in the console print output. Helps with the readability of deeply nested objects.info(optional, defaultTrue): Whether to output to the console additional information about the sampling process.ExamplesAn example of using@samplrto select a random subset of 3 items from a list returned by a function:fromsamplrimportsamplr@samplr(count=3,sample_type='random')defget_data():return[{'name':'Alice','age':32},{'name':'Bob','age':25},{'name':'Charlie','age':41},{'name':'David','age':19},{'name':'Eve','age':56},{'name':'Frank','age':28},{'name':'Grace','age':39},{'name':'Heidi','age':22},{'name':'Isaac','age':47},{'name':'Jen','age':31},]sampled_data=get_data()This will return a list of items and output something like this to the terminal:◆◇◆SAMPLR◆◇◆◇@samplr(count=3,sample_type=random)get_data()◆itemsreturned:3/10◇0::{"name":"Alice","age":32}◆3::{"name":"David","age":19}◇4::{"name":"Eve","age":56}◆◇◆end◆◇◆Note the enumeration in the printout shows each item's index in the original list.An example of using@samplrto exclude the last 2 items (withexpandandinfoset toFalse):@samplr(count=-2,sample_type='tail',expand=False,info=False)defget_data():return["zero","one","two","three","four","five","six"]This returns a list of length 5, and outputs a shorter statement to the terminal:◆0::"zero"◇1::"one"◆2::"two"◆3::"three"◆4::"four"
Package: samply
A Python library for generating space-filling sample sets of low to moderate
dimensional data from domains including:Euclidean spaceGrassmannian atlasSurface of an n-SphereA Collection of Space-filling Sampling Designs for Arbitrary Dimensions.
The API is structured such that the top level packages represent the shape
of the domain you are interested in:ball - The n-dimensional solid unit balldirectional - The space of unit length directions in n-dimensional space. You can also consider this a sampling of the boundary of the n-dimensional unit ball.hypercube - The n-dimensional solid unit hypercube\(x \\in [0,1]^n\).subspace - Sampling a n-1-dimensional subspace orthogonal to a unit vector or sampling the Grassmanian Atlas of projections from a dimension n to a lower dimension m.shape - a collection of (n-1)-manifold and non-manifold shapes embedded in an n dimensional space. For now these must all be sampled using a uniform distribution.Within each module is a list of ways to fill the space of the samples.
Note, that not all of the methods listed below are applicable to the modules
listed above. They include:Uniform - a random, uniform distribution of points (available for ball, directional, hypercube, subspace, and shape)Normal - a Gaussian distribution of points (available for hypercube)Multimodal - a mixture of Gaussian distributions of points (available for hypercube)CVT - an approximate centroidal Voronoi tessellation of the points constrained to the given space (available for hypercube and directional)LHS - a Latin hypercube sampling design of points constrained to the space (available for hypercube)The python CVT code is adapted from a C++ implementation provided by
Carlos Correa. The Grassmannian sampler is adapted from code from Shusen
Liu.InstallationA preliminary version is available on PyPI:pip install samplyOtherwise, you can download the repository for the most cutting edge additions:git clone https://github.com/maljovec/samply.git
cd samply
python setup.py [build|develop|install]UsageYou can use the library from python such as the examples below:import samply

direction_samples = samply.directional.uniform(10000, 2)
ball_samples = samply.ball.uniform(10000, 2)
scvt_samples = samply.directional.cvt(10000, 2)
cvt_samples = samply.hypercube.cvt(10000, 2)

projection_samples = samply.subspace.grassmannian(10000, 3, 2)The*samplesvariables will be NxD matrices where N is the number of samples requested and D is the dimensionality of the sampler or the requested dimensionality.TestingThe test suite can be run through the setup script:python setup.py testExampleTo test drive a subset of the different samplers in action, check out this littleweb apphosted on the Google Cloud Platform which is using samply under the covers. Note, the CVT is still rather inefficient for larger sample sizes.What’s NextForthcoming:Improved documentation
Package: samppy
Packagesamppyimplements Hamiltonian Markov-chain sampling and
some additional analysis methods for multivariate probability distributions.The probability distribution is represented only by
an array of independent and identically distributed (i.i.d.) samples
drawn from the distribution.The package includes four modules:Modulehamiltonian_samplerimplements Hamiltonian Markov-Chain sampling.
AHamiltonianSamplerinstance can generate
random samples of a multivariate probability distribution,
defined only by an non-normalizedlog-likelihoodfunction,
and thegradientof that function.The generated batch of sample vectors is stored in a 2D numpy array,
either as rows or as columns.ClassHamiltonianSamplerdefines a standard isotropic sampler.
ClassHamiltonianBoundedSampleris a subclass also allowing
one- or two-sided interval limits for all vector elements.Modulecredibilityincludes functions to estimatejointly credible differencesand/orcorrelationsbetween pairs of elements
in a random vector with a multivariate probability distribution,
represented only by samples.A separate modulecredibility_pdhas the same functionality,
but operates on input data in Pandas DataFrame or Series format.Modulesample_entropyincludes a function to estimate thedifferential entropyof a multivariate probability distribution, represented only by samples.
The entropy is estimated by the Kozachenko-Leonenko nearest-neighbor approximation
(Singh and Poczos, 2016).UsageThis package was developed mainly for use by another project.
It is distributed separately because it may be useful for other purposes.The Hamiltonian sampler code was inspired by the LAHMC project by
Jasha Sohlstein. The present implementation includes
some safety features to facilitate its use.
The present sampler doesnotinclude sampling within a general subspace manifold,
but it allows bounded ranges for vector elements.RequirementsThe package requires recent versions of Numpy and Scipy.
These are automatically installed.
Pandas is not installed automatically,
because the module requiring Pandas input
will only be called from a program that already uses Pandas.ReferencesR M Neal (2011): MCMC using Hamiltonian dynamics. Ch. 5 in
Brooks et al. (eds)Handbook of Markov Chain Monte Carlo.
Chapman and Hall / CRC Press.A. Leijon, G. E. Henter, and M. Dahlquist (2016):
Bayesian analysis of phoneme confusion matrices.IEEE Transactions on Audio, Speech, and Language Processing24(3):469–482.
(Describes an application of credible-difference calculation.)A. Leijon, P. von Gablenz, I. Holube, J. Taghia, and K. Smeds (2023).
Bayesian analysis of ecological momentary assessment (EMA) data
collected in adults before and after hearing rehabilitation.Frontiers in Digital Health, 5(1100705).downloadF Perez-Cruz (2008): Estimation of Information Theoretic Measures
for Continuous Random Variables.Advances in Neural Information Processing Systems 21 (NIPS 2008).S Singh and B Poczos (2016): Analysis of k-nearest neighbor distances
with application to entropy estimation.arXiv:1603.08578 [math.ST].
Package: samp-python
SAMP.pySAMP.py is a GTA SA:MP RCON and query client for Python.Installationpipinstallsamp-pyUsageYou can initalize a client like this:fromsamp_py.clientimportSampClientwithSampClient(address='localhost',port=7777)asclient:print(client.get_server_info())To run RCON commands:withSampClient(address='localhost',port=7777,rcon_password='password')asclient:client.rcon_cmdlist()Query and RCON responses can be accessed following the native route:withSampClient(address='localhost',port=7777,rcon_password='password')asclient:info=client.get_server_info()print(info)print(info.gamemode)print(client.rcon_get_hostname())print(client.rcon_players()[0].ping)There are not many exceptions:SampErrorRconErrorInvalidRconPasswordConnectionErrorHere is an whole example of a SAMP.py scriptimportsysfrombuiltinsimportinputfromsamp_py.clientimportSampClientdefinfo(client):print("""Server Info:Password:{info.password}Players:{info.players}/{info.max_players}Hostname:{info.hostname}Gamemode:{info.gamemode}Language:{info.language}""".format(info=client.get_server_info(),))defrules(client):print("Server Rules:")forruleinclient.get_server_rules():print("{rule.name}:{rule.value}".format(rule=rule,))defclients(client):print("Connected Clients")print("Name                       | Score".format(client=client))print("==================================")forclientinclient.get_server_clients():print("{client.name:26}|{client.score}".format(client=client))defdetails(client):print("Detailed Clients")print(" ID |Name                        | Score | Ping".format(client=client))print("===============================================")forclientinclient.get_server_clients_detailed():print("{client.id:3}|{client.name:26}|{client.score:5}|{client.ping:4}".format(client=client))defrcon(client):ifclient.rcon_passwordisNone:client.rcon_password=input('RCON password:')print('Enter rcon commands or leave blank to exit. Example: cmdlist')whileTrue:command=input('RCON: ')ifnotcommand:returnforlineinclient.send_rcon_command(command):print(line)defmain(args):withSampClient(*args)asclient:ifnotclient.is_online():print('Server{}:{}is offline'.format(*args))exit(1)server_info=client.get_server_info()print("""Connected to{info.hostname}.Currently{info.players}/{info.max_players}players online.Select one of the options:i. Server Infor. Server Rulesc. Connected clientsd. Detailed clientsx. RCON""".format(info=server_info,))options={'i':info,'r':rules,'c':clients,'d':details,'x':rcon,}option=input('Select option: ')ifoptioninoptions:options[option](client)else:print('Unknown option, bye!')iflen(sys.argv)<3:print('Usage: py example.py [server_address] [port]')exit(1)main(sys.argv[1:])
Package: samp-query
samp-querysamp-query is a Python library for interacting with SA-MP/open.mp servers using the query protocol.
It provides functionality to query server information, retrieve player list, show rules, and execute remote console (RCON) commands.InstallationTo install the library, you can usepip:pipinstallsamp-queryFeaturesConnect to a game server using IP address and port.Retrieve server information including name, player count, maximum players, gamemode, and language.Get a list of players currently on the server with their name and score.Fetch a list of rules and their values set on the server.Execute RCON commands on the server (requires RCON password).UsageHere's a basic example of how to use the library:importtriofromsamp_queryimportClientasyncdefmain():client=Client(ip='127.0.0.1',port=7777,rcon_password=None,# Your rcon password as string)info=awaitclient.info()print(f'Server Name:{info.name}')print(f'Player Count:{info.players}/{info.max_players}')player_list=awaitclient.players()print('Players:')forplayerinplayer_list.players:print(f'-{player.name}(Score:{player.score})')rule_list=awaitclient.rules()print('Rules:')forruleinrule_list.rules:print(f'-{rule.name}:{rule.value}')ifclient.rcon_password:response=awaitclient.rcon('echo Hello, server!')print(f'RCON Response:{response}')trio.run(main)Make sure to replace'127.0.0.1'and7777with the actual IP address and port of the game server you want to connect to. If the server has RCON enabled, provide a password in thercon_passwordattribute of thesamp_query.Clientinstance (otherwise keep it None).DocumentationFor more information, you canread the documentation.
Package: sampy-abm
Sampy is a library designed to simplify ABM development in epidemiology.More information on how to use the library can be found in the associated publication, available as a preprint at:https://www.preprints.org/manuscript/202211.0556/v2If you have any modelling needs that the current version cannot support, or if you want to contribute to the project, feel free to send a mail tosampy.project@gmail.com
Package: sam-pytorch
Sharpness Aware Minimization (SAM) in PyTorchThis repository is the generic implementation ofsam.pytorch(repository). All credits to@moskomule.InstallationLatest release:pip install sam-pytorchLatest code:pip install git+https://github.com/tourdeml/sam/DocsVisitsam-pytorch.readthedocs.ioExplanationSee the blog post (Tour de ML)Citation@ARTICLE{2020arXiv201001412F,
    author = {{Foret}, Pierre and {Kleiner}, Ariel and {Mobahi}, Hossein and {Neyshabur}, Behnam},
    title = "{Sharpness-Aware Minimization for Efficiently Improving Generalization}",
    year = 2020,
    eid = {arXiv:2010.01412},
    eprint = {2010.01412},
}

@software{sampytorch,
    author = {Ryuichiro Hataya},
    titile = {sam.pytorch},
    url    = {https://github.com/moskomule/sam.pytorch},
    year   = {2020}
}

@software{tourdemlsam,
    author = {Vaibhav Balloli},
    titile = "{SAM implementation in PyTorch}",
    url    = {https://github.com/tourdeml/sam},
    year   = {2021}
}

@misc{balloli2021sam:,
  author = {Balloli, Vaibhav},
  title = {Tour de ML: SAM: Sharpness-Aware Maximization},
  url = {https://tourdeml.github.io/blog/posts/2021-02-26-sam-sharpness-aware-maximization/},
  year = {2021}
}