Re: math: how to initialize a custom prob. distribution function
On Fri, 29 Sept 2023 at 18:49, Siddharth Jain wrote: > > thanks. i see this is filed under legacy namespace with the comment > Implementations > of common discrete and continuous distributions. [Mostly moved to the > "Commons Statistics" project (cf. JIRA: MATH-1443).] > i then checked > https://commons.apache.org/proper/commons-statistics/commons-statistics-distribution/apidocs/allclasses-noframe.html > but could not see this class there. should i still use commons-math? and > the 4.0-beta1 does not seem to be in maven repository. could i get link to > mvn coordinates if its published on maven? https://central.sonatype.com/artifact/org.apache.commons/commons-math4-legacy There are some distribution classes that remain in Commons Math as they use more math code than just the functions required to implement standard distributions. The legacy module contains most of what was in Commons Math 3. This is code that has not been refactored into modules within the modular Commons Math 4 layout, or undergone a complete rewrite as a new project (see Commons RNG, Numbers, Statistics and Geometry). Alex - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: math: how to initialize a custom prob. distribution function
thanks. i see this is filed under legacy namespace with the comment Implementations of common discrete and continuous distributions. [Mostly moved to the "Commons Statistics" project (cf. JIRA: MATH-1443).] i then checked https://commons.apache.org/proper/commons-statistics/commons-statistics-distribution/apidocs/allclasses-noframe.html but could not see this class there. should i still use commons-math? and the 4.0-beta1 does not seem to be in maven repository. could i get link to mvn coordinates if its published on maven? On Fri, Sep 29, 2023 at 10:10 AM Alex Herbert wrote: > This may be what you require: > > > https://commons.apache.org/proper/commons-math/javadocs/api-4.0-beta1/org/apache/commons/math4/legacy/distribution/EmpiricalDistribution.html > > You will have to convert your float values to double and then specify > the bin size: > > float[] x = ... > int bins = 100; > ContinuousDistribution d = EmpiricalDistribution.from(bins, > IntStream.range(0, x.length).mapToDouble(i -> x[i]).toArray()); > > On Fri, 29 Sept 2023 at 17:44, Siddharth Jain wrote: > > > > I have a vector float[] x containing samples of a random variable. I > would > > like to initialize a prob. distribution fn. using these samples and then > be > > able to call methods like > > > https://commons.apache.org/proper/commons-statistics/commons-statistics-distribution/apidocs/org/apache/commons/statistics/distribution/ContinuousDistribution.html > > > > I am looking for an API like: > > > > var f = ContinuousDistribution.of(x) > > > > is this available in commons-math? thanks. > > > > S. > > - > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org > For additional commands, e-mail: user-h...@commons.apache.org > >
Re: math: how to initialize a custom prob. distribution function
This may be what you require: https://commons.apache.org/proper/commons-math/javadocs/api-4.0-beta1/org/apache/commons/math4/legacy/distribution/EmpiricalDistribution.html You will have to convert your float values to double and then specify the bin size: float[] x = ... int bins = 100; ContinuousDistribution d = EmpiricalDistribution.from(bins, IntStream.range(0, x.length).mapToDouble(i -> x[i]).toArray()); On Fri, 29 Sept 2023 at 17:44, Siddharth Jain wrote: > > I have a vector float[] x containing samples of a random variable. I would > like to initialize a prob. distribution fn. using these samples and then be > able to call methods like > https://commons.apache.org/proper/commons-statistics/commons-statistics-distribution/apidocs/org/apache/commons/statistics/distribution/ContinuousDistribution.html > > I am looking for an API like: > > var f = ContinuousDistribution.of(x) > > is this available in commons-math? thanks. > > S. - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
math: how to initialize a custom prob. distribution function
I have a vector float[] x containing samples of a random variable. I would like to initialize a prob. distribution fn. using these samples and then be able to call methods like https://commons.apache.org/proper/commons-statistics/commons-statistics-distribution/apidocs/org/apache/commons/statistics/distribution/ContinuousDistribution.html I am looking for an API like: var f = ContinuousDistribution.of(x) is this available in commons-math? thanks. S.
Re: Projects that use org.apache.commons.math3.optim.linear.*;
Hi Jorge, This may be of some help in building a list: https://mvnrepository.com/artifact/org.apache.commons/commons-math3 I think you would need to do some digging to get the fine detail and this would only be that fraction that is mavenised. HTH Andy From: Jorge Garcia de Alba Sent: 28 September 2023 16:20 To: user@commons.apache.org Subject: Projects that use org.apache.commons.math3.optim.linear.*; Hello, What projects in the world use org.apache.commons.math3.optim.linear.* ? Is there a list? Jorge - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [commons-fileupload2-jakarta] JakartaServletFileUpload.getItemIterator() not working in 2.0.0-M1
Please provide a patch attached to a Jira ticket or a PR for a failing unit test to make it simple for a maintainer to help you out. Gary On Thu, Sep 28, 2023, 12:39 AM Maxim Solodovnik wrote: > Hello, > > I've tried to check this one :) > > Modified this test: > > commons-fileupload2-jakarta-servlet5/src/test/java/org/apache/commons/fileupload2/jakarta/servlet5/JakartaServletFileUploadTest.java > > Add this block at the bottom: > > ``` > final var itemCount = new AtomicInteger(0); > upload.getItemIterator(new JakartaMockServletHttpRequest(bytes, > Constants.CONTENT_TYPE)).forEachRemaining(item -> { > String name = item.getFieldName(); > InputStream stream = item.getInputStream(); > if (item.isFormField()) { > System.out.println("Form field " + name + " with value " + " > detected."); > } else { > System.out.println("File field " + name + " with file name " + > item.getName() + " detected."); > // Process the input stream > } > }); > assertEquals(4, itemCount.get()); > ``` > > The test is GREEN > > BUT > > if i try to reuse previously created request like this: > > ``` > upload.getItemIterator(request).forEachRemaining(item -> { > ``` > > The test will fail > > > Is it be possible request was already iterated before > `forEachRemaining` was called? > > On Thu, 28 Sept 2023 at 08:31, Gary Gregory > wrote: > > > > Hi, > > > > The best way to help would be to provide a PR on GitHub with a failing > > test, and if you find it, a fix. > > > > Gary > > > > > > On Wed, Sep 27, 2023, 7:33 PM Ian Evans > > wrote: > > > > > Using the following library: > > > > > > > > > org.apache.commons > > > commons-fileupload2-jakarta > > > 2.0.0-M1 > > > > > > > > > The Streaming API (documented here FileUpload – The Streaming API ( > > > apache.org)< > > > https://commons.apache.org/proper/commons-fileupload/streaming.html>) > > > does not return any items. I've tested the following code using > postman and > > > curl to send a multipart/form-data request, in both cases > getItemIterator > > > fails to return any items (internally it seems an exceptio is thrown): > > > > > > > > > public ResponseEntity upload(HttpServletRequest request) throws > > > IOException { > > > if (!JakartaServletFileUpload.isMultipartContent(request)) { > > > throw new IllegalArgumentException("not multipart"); > > > } > > > > > > JakartaServletFileUpload upload = new > JakartaServletFileUpload(); > > > > > > upload.getItemIterator(request).forEachRemaining(item -> { > > > String name = item.getFieldName(); > > > InputStream stream = item.getInputStream(); > > > if (item.isFormField()) { > > > System.out.println("Form field " + name + " with value > " > > > + convertInputStreamToString(stream) + " > > > detected."); > > > } else { > > > System.out.println("File field " + name + " with file > name > > > " > > > + item.getName() + " detected."); > > > // Process the input stream > > > } > > > }); > > > ... > > > } > > > > > > If I can help diagnose the issue in any way I'm more than happy. > > > > > > > > > > > > > > > > -- > Best regards, > Maxim > > - > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org > For additional commands, e-mail: user-h...@commons.apache.org > >