diff --git a/ChangeLog b/ChangeLog
index 0320e3bd9e..acf1a50cc3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,7 @@
* Deprecated BayesDistribution in favor of JointByConditioningDistribution
* Deprecated ConditionalDistribution in favor of DeconditionedDistribution
* Deprecated NegativeBinomial in favor of Polya
+ * Deprecated NegativeBinomialFactory in favor of PolyaFactory
=== Documentation ===
* Copy button for code blocks
diff --git a/lib/etc/openturns.conf.in b/lib/etc/openturns.conf.in
index 452d1ca672..6945f761ea 100644
--- a/lib/etc/openturns.conf.in
+++ b/lib/etc/openturns.conf.in
@@ -626,11 +626,11 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/lib/src/Base/Common/ResourceMap.cxx b/lib/src/Base/Common/ResourceMap.cxx
index 77975c04b6..272b1efca0 100644
--- a/lib/src/Base/Common/ResourceMap.cxx
+++ b/lib/src/Base/Common/ResourceMap.cxx
@@ -1252,11 +1252,11 @@ void ResourceMap::loadDefaultConfiguration()
addAsScalar("Multinomial-eta", 1.0e-9);
addAsScalar("Multinomial-smallA", 10.0);
- // NegativeBinomialFactory parameters //
- addAsScalar("NegativeBinomialFactory-AbsolutePrecision", 1.0e-12);
- addAsScalar("NegativeBinomialFactory-RelativePrecision", 1.0e-12);
- addAsScalar("NegativeBinomialFactory-ResidualPrecision", 1.0e-12);
- addAsUnsignedInteger("NegativeBinomialFactory-MaximumIteration", 50);
+ // PolyaFactory parameters //
+ addAsScalar("PolyaFactory-AbsolutePrecision", 1.0e-12);
+ addAsScalar("PolyaFactory-RelativePrecision", 1.0e-12);
+ addAsScalar("PolyaFactory-ResidualPrecision", 1.0e-12);
+ addAsUnsignedInteger("PolyaFactory-MaximumIteration", 50);
// Normal parameters //
addAsScalar("Normal-MaximumCDFEpsilon", 5.0e-6);
diff --git a/lib/src/Uncertainty/Distribution/CMakeLists.txt b/lib/src/Uncertainty/Distribution/CMakeLists.txt
index bb2832123b..4e6e820e3b 100644
--- a/lib/src/Uncertainty/Distribution/CMakeLists.txt
+++ b/lib/src/Uncertainty/Distribution/CMakeLists.txt
@@ -119,7 +119,7 @@ ot_add_source_file (Mixture.cxx)
ot_add_source_file (Multinomial.cxx)
ot_add_source_file (MultinomialFactory.cxx)
ot_add_source_file (Polya.cxx)
-ot_add_source_file (NegativeBinomialFactory.cxx)
+ot_add_source_file (PolyaFactory.cxx)
ot_add_source_file (NonCentralChiSquare.cxx)
ot_add_source_file (NonCentralStudent.cxx)
ot_add_source_file (Normal2DCDF.cxx)
@@ -294,7 +294,7 @@ ot_install_header_file (Mixture.hxx)
ot_install_header_file (MultinomialFactory.hxx)
ot_install_header_file (Multinomial.hxx)
ot_install_header_file (Polya.hxx)
-ot_install_header_file (NegativeBinomialFactory.hxx)
+ot_install_header_file (PolyaFactory.hxx)
ot_install_header_file (NonCentralChiSquare.hxx)
ot_install_header_file (NonCentralStudent.hxx)
ot_install_header_file (Normal2DCDF.hxx)
diff --git a/lib/src/Uncertainty/Distribution/NegativeBinomialFactory.cxx b/lib/src/Uncertainty/Distribution/PolyaFactory.cxx
similarity index 82%
rename from lib/src/Uncertainty/Distribution/NegativeBinomialFactory.cxx
rename to lib/src/Uncertainty/Distribution/PolyaFactory.cxx
index ae8e6e84c9..937123a961 100644
--- a/lib/src/Uncertainty/Distribution/NegativeBinomialFactory.cxx
+++ b/lib/src/Uncertainty/Distribution/PolyaFactory.cxx
@@ -18,7 +18,7 @@
* along with this library. If not, see .
*
*/
-#include "openturns/NegativeBinomialFactory.hxx"
+#include "openturns/PolyaFactory.hxx"
#include "openturns/SpecFunc.hxx"
#include "openturns/MethodBoundEvaluation.hxx"
#include "openturns/Brent.hxx"
@@ -27,21 +27,21 @@
BEGIN_NAMESPACE_OPENTURNS
-CLASSNAMEINIT(NegativeBinomialFactory)
+CLASSNAMEINIT(PolyaFactory)
-static const Factory Factory_NegativeBinomialFactory;
+static const Factory Factory_PolyaFactory;
/* Default constructor */
-NegativeBinomialFactory::NegativeBinomialFactory()
+PolyaFactory::PolyaFactory()
: DistributionFactoryImplementation()
{
// Nothing to do
}
/* Virtual constructor */
-NegativeBinomialFactory * NegativeBinomialFactory::clone() const
+PolyaFactory * PolyaFactory::clone() const
{
- return new NegativeBinomialFactory(*this);
+ return new PolyaFactory(*this);
}
@@ -76,22 +76,22 @@ struct NegativeBinomialFactoryParameterConstraint
Scalar mean_;
};
-Distribution NegativeBinomialFactory::build(const Sample & sample) const
+Distribution PolyaFactory::build(const Sample & sample) const
{
return buildAsNegativeBinomial(sample).clone();
}
-Distribution NegativeBinomialFactory::build(const Point & parameters) const
+Distribution PolyaFactory::build(const Point & parameters) const
{
return buildAsNegativeBinomial(parameters).clone();
}
-Distribution NegativeBinomialFactory::build() const
+Distribution PolyaFactory::build() const
{
return buildAsNegativeBinomial().clone();
}
-Polya NegativeBinomialFactory::buildAsNegativeBinomial(const Sample & sample) const
+Polya PolyaFactory::buildAsNegativeBinomial(const Sample & sample) const
{
const UnsignedInteger size = sample.getSize();
if (size < 2) throw InvalidArgumentException(HERE) << "Error: cannot build a Polya distribution from a sample of size < 2";
@@ -134,7 +134,7 @@ Polya NegativeBinomialFactory::buildAsNegativeBinomial(const Sample & sample) co
fB = f(Point(1, b))[0];
}
// Solve the constraint equation
- Brent solver(ResourceMap::GetAsScalar("NegativeBinomialFactory-AbsolutePrecision"), ResourceMap::GetAsScalar("NegativeBinomialFactory-RelativePrecision"), ResourceMap::GetAsScalar("NegativeBinomialFactory-ResidualPrecision"), ResourceMap::GetAsUnsignedInteger("NegativeBinomialFactory-MaximumIteration"));
+ Brent solver(ResourceMap::GetAsScalar("PolyaFactory-AbsolutePrecision"), ResourceMap::GetAsScalar("PolyaFactory-RelativePrecision"), ResourceMap::GetAsScalar("PolyaFactory-ResidualPrecision"), ResourceMap::GetAsUnsignedInteger("PolyaFactory-MaximumIteration"));
// R estimate
const Scalar r = solver.solve(f, 0.0, a, b, fA, fB);
// Corresponding p estimate
@@ -144,7 +144,7 @@ Polya NegativeBinomialFactory::buildAsNegativeBinomial(const Sample & sample) co
return result;
}
-Polya NegativeBinomialFactory::buildAsNegativeBinomial(const Point & parameters) const
+Polya PolyaFactory::buildAsNegativeBinomial(const Point & parameters) const
{
try
{
@@ -158,7 +158,7 @@ Polya NegativeBinomialFactory::buildAsNegativeBinomial(const Point & parameters)
}
}
-Polya NegativeBinomialFactory::buildAsNegativeBinomial() const
+Polya PolyaFactory::buildAsNegativeBinomial() const
{
return Polya();
}
diff --git a/lib/src/Uncertainty/Distribution/openturns/OTDistribution.hxx b/lib/src/Uncertainty/Distribution/openturns/OTDistribution.hxx
index 49396d4ce7..39d21276d4 100644
--- a/lib/src/Uncertainty/Distribution/openturns/OTDistribution.hxx
+++ b/lib/src/Uncertainty/Distribution/openturns/OTDistribution.hxx
@@ -128,7 +128,7 @@
#include "openturns/Multinomial.hxx"
#include "openturns/MultinomialFactory.hxx"
#include "openturns/Polya.hxx"
-#include "openturns/NegativeBinomialFactory.hxx"
+#include "openturns/PolyaFactory.hxx"
#include "openturns/NonCentralChiSquare.hxx"
#include "openturns/NonCentralStudent.hxx"
#include "openturns/Normal2DCDF.hxx"
diff --git a/lib/src/Uncertainty/Distribution/openturns/NegativeBinomialFactory.hxx b/lib/src/Uncertainty/Distribution/openturns/PolyaFactory.hxx
similarity index 82%
rename from lib/src/Uncertainty/Distribution/openturns/NegativeBinomialFactory.hxx
rename to lib/src/Uncertainty/Distribution/openturns/PolyaFactory.hxx
index ecea5fe599..7f7313a8c0 100644
--- a/lib/src/Uncertainty/Distribution/openturns/NegativeBinomialFactory.hxx
+++ b/lib/src/Uncertainty/Distribution/openturns/PolyaFactory.hxx
@@ -18,8 +18,8 @@
* along with this library. If not, see .
*
*/
-#ifndef OPENTURNS_NEGATIVEBINOMIALFACTORY_HXX
-#define OPENTURNS_NEGATIVEBINOMIALFACTORY_HXX
+#ifndef OPENTURNS_POLYAFACTORY_HXX
+#define OPENTURNS_POLYAFACTORY_HXX
#include "openturns/OTprivate.hxx"
#include "openturns/DistributionFactoryImplementation.hxx"
@@ -28,19 +28,19 @@
BEGIN_NAMESPACE_OPENTURNS
/**
- * @class NegativeBinomialFactory
+ * @class PolyaFactory
*/
-class OT_API NegativeBinomialFactory
+class OT_API PolyaFactory
: public DistributionFactoryImplementation
{
CLASSNAME
public:
/** Default constructor */
- NegativeBinomialFactory();
+ PolyaFactory();
/** Virtual constructor */
- NegativeBinomialFactory * clone() const override;
+ PolyaFactory * clone() const override;
/* Here is the interface that all derived class must implement */
using DistributionFactoryImplementation::build;
@@ -52,9 +52,9 @@ public:
Polya buildAsNegativeBinomial(const Point & parameters) const;
Polya buildAsNegativeBinomial() const;
-}; /* class NegativeBinomialFactory */
+}; /* class PolyaFactory */
END_NAMESPACE_OPENTURNS
-#endif /* OPENTURNS_NEGATIVEBINOMIALFACTORY_HXX */
+#endif /* OPENTURNS_POLYAFACTORY_HXX */
diff --git a/lib/src/Uncertainty/Model/DistributionFactory.cxx b/lib/src/Uncertainty/Model/DistributionFactory.cxx
index becfa17e84..c7beec2163 100644
--- a/lib/src/Uncertainty/Model/DistributionFactory.cxx
+++ b/lib/src/Uncertainty/Model/DistributionFactory.cxx
@@ -53,7 +53,7 @@
#include "openturns/LogUniformFactory.hxx"
#include "openturns/MeixnerDistributionFactory.hxx"
#include "openturns/MultinomialFactory.hxx"
-#include "openturns/NegativeBinomialFactory.hxx"
+#include "openturns/PolyaFactory.hxx"
#include "openturns/NormalCopulaFactory.hxx"
#include "openturns/NormalFactory.hxx"
#include "openturns/ParetoFactory.hxx"
@@ -141,7 +141,7 @@ DistributionFactory::DistributionFactoryCollection DistributionFactory::GetDiscr
collection.add(DiracFactory());
collection.add(GeometricFactory());
collection.add(MultinomialFactory());
- collection.add(NegativeBinomialFactory());
+ collection.add(PolyaFactory());
collection.add(PoissonFactory());
collection.add(UserDefinedFactory());
collection.add(SkellamFactory());
diff --git a/lib/test/CMakeLists.txt b/lib/test/CMakeLists.txt
index 42006ed155..331b62e1b1 100644
--- a/lib/test/CMakeLists.txt
+++ b/lib/test/CMakeLists.txt
@@ -413,7 +413,7 @@ ot_check_test (Mixture_std)
ot_check_test (Multinomial_std)
ot_check_test (MultinomialFactory_std)
ot_check_test (Polya_std)
-ot_check_test (NegativeBinomialFactory_std)
+ot_check_test (PolyaFactory_std)
ot_check_test (NonCentralChiSquare_std)
if (Boost_FOUND)
ot_check_test (NonCentralStudent_std)
diff --git a/lib/test/t_DistributionFactory_std.expout b/lib/test/t_DistributionFactory_std.expout
index 3a8fa7d5eb..d489af79ef 100644
--- a/lib/test/t_DistributionFactory_std.expout
+++ b/lib/test/t_DistributionFactory_std.expout
@@ -1,6 +1,6 @@
Continuous univariate factories=[ArcsineFactory,BetaFactory,BurrFactory,ChiFactory,ChiSquareFactory,DirichletFactory,ExponentialFactory,FisherSnedecorFactory,FrechetFactory,GammaFactory,GeneralizedParetoFactory,GumbelFactory,HistogramFactory,InverseNormalFactory,LaplaceFactory,LogisticFactory,LogNormalFactory,LogUniformFactory,MeixnerDistributionFactory,NormalFactory,ParetoFactory,RayleighFactory,RiceFactory,SmoothedUniformFactory,StudentFactory,TrapezoidalFactory,TriangularFactory,TruncatedNormalFactory,UniformFactory,VonMisesFactory,WeibullMaxFactory,WeibullMinFactory]#32
Continuous multivariate factories=[AliMikhailHaqCopulaFactory,BernsteinCopulaFactory,ClaytonCopulaFactory,DirichletFactory,FarlieGumbelMorgensternCopulaFactory,FrankCopulaFactory,GumbelCopulaFactory,NormalCopulaFactory,NormalFactory,PlackettCopulaFactory,StudentFactory]#11
-Discrete univariate factories=[BernoulliFactory,BinomialFactory,DiracFactory,GeometricFactory,MultinomialFactory,NegativeBinomialFactory,PoissonFactory,UserDefinedFactory,SkellamFactory]
+Discrete univariate factories=[BernoulliFactory,BinomialFactory,DiracFactory,GeometricFactory,MultinomialFactory,PolyaFactory,PoissonFactory,UserDefinedFactory,SkellamFactory]
Discrete multivariate factories=[DiracFactory,MultinomialFactory,UserDefinedFactory]
-Univariate factories=[ArcsineFactory,BetaFactory,BurrFactory,ChiFactory,ChiSquareFactory,DirichletFactory,ExponentialFactory,FisherSnedecorFactory,FrechetFactory,GammaFactory,GeneralizedParetoFactory,GumbelFactory,HistogramFactory,InverseNormalFactory,LaplaceFactory,LogisticFactory,LogNormalFactory,LogUniformFactory,MeixnerDistributionFactory,NormalFactory,ParetoFactory,RayleighFactory,RiceFactory,SmoothedUniformFactory,StudentFactory,TrapezoidalFactory,TriangularFactory,TruncatedNormalFactory,UniformFactory,VonMisesFactory,WeibullMaxFactory,WeibullMinFactory,BernoulliFactory,BinomialFactory,DiracFactory,GeometricFactory,MultinomialFactory,NegativeBinomialFactory,PoissonFactory,UserDefinedFactory,SkellamFactory]#41
+Univariate factories=[ArcsineFactory,BetaFactory,BurrFactory,ChiFactory,ChiSquareFactory,DirichletFactory,ExponentialFactory,FisherSnedecorFactory,FrechetFactory,GammaFactory,GeneralizedParetoFactory,GumbelFactory,HistogramFactory,InverseNormalFactory,LaplaceFactory,LogisticFactory,LogNormalFactory,LogUniformFactory,MeixnerDistributionFactory,NormalFactory,ParetoFactory,RayleighFactory,RiceFactory,SmoothedUniformFactory,StudentFactory,TrapezoidalFactory,TriangularFactory,TruncatedNormalFactory,UniformFactory,VonMisesFactory,WeibullMaxFactory,WeibullMinFactory,BernoulliFactory,BinomialFactory,DiracFactory,GeometricFactory,MultinomialFactory,PolyaFactory,PoissonFactory,UserDefinedFactory,SkellamFactory]#41
Multivariate factories=[AliMikhailHaqCopulaFactory,BernsteinCopulaFactory,ClaytonCopulaFactory,DirichletFactory,FarlieGumbelMorgensternCopulaFactory,FrankCopulaFactory,GumbelCopulaFactory,NormalCopulaFactory,NormalFactory,PlackettCopulaFactory,StudentFactory,DiracFactory,MultinomialFactory,UserDefinedFactory]#14
diff --git a/lib/test/t_NegativeBinomialFactory_std.cxx b/lib/test/t_PolyaFactory_std.cxx
similarity index 98%
rename from lib/test/t_NegativeBinomialFactory_std.cxx
rename to lib/test/t_PolyaFactory_std.cxx
index dd4e37236d..1ee807a2d9 100644
--- a/lib/test/t_NegativeBinomialFactory_std.cxx
+++ b/lib/test/t_PolyaFactory_std.cxx
@@ -35,7 +35,7 @@ int main(int, char *[])
Polya distribution(15, 0.7);
UnsignedInteger size = 10000;
Sample sample(distribution.getSample(size));
- NegativeBinomialFactory factory;
+ PolyaFactory factory;
Distribution estimatedDistribution(factory.build(sample));
fullprint << "Distribution =" << distribution << std::endl;
fullprint << "Estimated distribution=" << estimatedDistribution << std::endl;
diff --git a/lib/test/t_NegativeBinomialFactory_std.expout b/lib/test/t_PolyaFactory_std.expout
similarity index 100%
rename from lib/test/t_NegativeBinomialFactory_std.expout
rename to lib/test/t_PolyaFactory_std.expout
diff --git a/python/doc/user_manual/statistics_on_sample.rst b/python/doc/user_manual/statistics_on_sample.rst
index b7981e0fac..911cd98226 100644
--- a/python/doc/user_manual/statistics_on_sample.rst
+++ b/python/doc/user_manual/statistics_on_sample.rst
@@ -85,7 +85,7 @@ Building distributions from samples
:template: DistributionFactory.rst_t
MultinomialFactory
- NegativeBinomialFactory
+ PolyaFactory
NormalFactory
ParetoFactory
PoissonFactory
diff --git a/python/src/CMakeLists.txt b/python/src/CMakeLists.txt
index 0e8ee9ecb1..202bea21bf 100644
--- a/python/src/CMakeLists.txt
+++ b/python/src/CMakeLists.txt
@@ -710,7 +710,7 @@ ot_add_python_module(dist_bundle2 dist_bundle2_module.i
Multinomial.i Multinomial_doc.i.in
MultinomialFactory.i MultinomialFactory_doc.i.in
Polya.i Polya_doc.i.in
- NegativeBinomialFactory.i NegativeBinomialFactory_doc.i.in
+ PolyaFactory.i PolyaFactory_doc.i.in
NonCentralChiSquare.i NonCentralChiSquare_doc.i.in
NonCentralStudent.i NonCentralStudent_doc.i.in
Normal.i Normal_doc.i.in
diff --git a/python/src/NegativeBinomialFactory.i b/python/src/NegativeBinomialFactory.i
deleted file mode 100644
index 42674fab3e..0000000000
--- a/python/src/NegativeBinomialFactory.i
+++ /dev/null
@@ -1,11 +0,0 @@
-// SWIG file NegativeBinomialFactory.i
-
-%{
-#include "openturns/NegativeBinomialFactory.hxx"
-%}
-
-%include NegativeBinomialFactory_doc.i
-
-%copyctor OT::NegativeBinomialFactory;
-
-%include openturns/NegativeBinomialFactory.hxx
diff --git a/python/src/PolyaFactory.i b/python/src/PolyaFactory.i
new file mode 100644
index 0000000000..2cbd923904
--- /dev/null
+++ b/python/src/PolyaFactory.i
@@ -0,0 +1,11 @@
+// SWIG file PolyaFactory.i
+
+%{
+#include "openturns/PolyaFactory.hxx"
+%}
+
+%include PolyaFactory_doc.i
+
+%copyctor OT::PolyaFactory;
+
+%include openturns/PolyaFactory.hxx
diff --git a/python/src/NegativeBinomialFactory_doc.i.in b/python/src/PolyaFactory_doc.i.in
similarity index 89%
rename from python/src/NegativeBinomialFactory_doc.i.in
rename to python/src/PolyaFactory_doc.i.in
index 4a7ced5db5..d4d1ac70ac 100644
--- a/python/src/NegativeBinomialFactory_doc.i.in
+++ b/python/src/PolyaFactory_doc.i.in
@@ -1,4 +1,4 @@
-%feature("docstring") OT::NegativeBinomialFactory
+%feature("docstring") OT::PolyaFactory
"Negative Binomial factory.
Notes
@@ -22,7 +22,7 @@ DistributionFactory, Polya"
// ---------------------------------------------------------------------
-%feature("docstring") OT::NegativeBinomialFactory::buildAsNegativeBinomial
+%feature("docstring") OT::PolyaFactory::buildAsNegativeBinomial
"Estimate the distribution as native distribution.
**Available usages**:
diff --git a/python/src/dist_bundle2_module.i b/python/src/dist_bundle2_module.i
index c63aade6c9..963759fee0 100644
--- a/python/src/dist_bundle2_module.i
+++ b/python/src/dist_bundle2_module.i
@@ -62,7 +62,7 @@
%include Multinomial.i
%include MultinomialFactory.i
%include Polya.i
-%include NegativeBinomialFactory.i
+%include PolyaFactory.i
%include NonCentralChiSquare.i
%include NonCentralStudent.i
%include Normal.i
diff --git a/python/test/CMakeLists.txt b/python/test/CMakeLists.txt
index 8ad5ac478e..8210d18814 100644
--- a/python/test/CMakeLists.txt
+++ b/python/test/CMakeLists.txt
@@ -521,7 +521,7 @@ ot_pyinstallcheck_test (Mixture_std)
ot_pyinstallcheck_test (Multinomial_std)
ot_pyinstallcheck_test (MultinomialFactory_std)
ot_pyinstallcheck_test (Polya_std)
-ot_pyinstallcheck_test (NegativeBinomialFactory_std)
+ot_pyinstallcheck_test (PolyaFactory_std)
ot_pyinstallcheck_test (NonCentralChiSquare_std)
if (Boost_FOUND)
ot_pyinstallcheck_test (NonCentralStudent_std)
diff --git a/python/test/t_NegativeBinomialFactory_std.expout b/python/test/t_PolyaFactory_std.expout
similarity index 100%
rename from python/test/t_NegativeBinomialFactory_std.expout
rename to python/test/t_PolyaFactory_std.expout
diff --git a/python/test/t_NegativeBinomialFactory_std.py b/python/test/t_PolyaFactory_std.py
similarity index 96%
rename from python/test/t_NegativeBinomialFactory_std.py
rename to python/test/t_PolyaFactory_std.py
index fc45c1749b..2f4965bd77 100755
--- a/python/test/t_NegativeBinomialFactory_std.py
+++ b/python/test/t_PolyaFactory_std.py
@@ -7,7 +7,7 @@
distribution = ot.Polya(15, 0.7)
size = 10000
sample = distribution.getSample(size)
-factory = ot.NegativeBinomialFactory()
+factory = ot.PolyaFactory()
estimatedDistribution = factory.build(sample)
print("distribution=", repr(distribution))
print("Estimated distribution=", repr(estimatedDistribution))