सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
सांख्यिकी पैकेज डेटा संचालन के लिए व्यापक साधनों का समर्थन करता है, जिसमें निर्मित बेयसियन नेटवर्क (बेयस नेट) समर्थन और बहुत सारे गणितीय कार्यक्रम शामिल हैं। दक्षता और उपयोग में आसानी के लिए डिज़ाइन किया गया, यह डेवलपर्स को Flutter एप्लिकेशन में सांख्यिकीय विश्लेषण, संभावना की गणना और संभाव्यता मॉडलिंग करने की अनुमति देता है। डेटा-आधारित निर्णय लेने, पूर्वानुमान विश्लेषण या मशीन लर्निंग एकीकरण की आवश्यकता वाले एप्लिकेशन के लिए उपयुक्त, यह पैकेज Android, iOS, Web, macOS, Windows और Linux सहित कई प्लेटफॉर्मों का समर्थन करता है। इसकी मॉड्यूलर संरचना मौजूदा प्रोजेक्ट में बिना किसी दिक्कत के एकीकरण की अनुमति देती है।
उपयोग
मोबाइल ऐप में डेटा विश्लेषण
बेस नेट्स के साथ संभावना मॉडलिंग
रियल-टाइम में सांख्यिकीय गणना
मशीन लर्निंग प्रीप्रोसेसिंग
सांख्यिकी के लिए शैक्षिक उपकरण
व्यावसायिक एप्लिकेशन में प्रीडिक्टिव एनालिटिक्स
मुख्य विशेषताएँ
निर्मित बेयजियन नेटवर्क कार्यान्वयन
विस्तृत गणितीय फ़ंक्शन लाइब्रेरी
क्रॉस-प्लेटफॉर्म संगतता
कुशल डेटा संचालन उपकरण
संभाव्यता वितरण के लिए समर्थन
Flutter pub के माध्यम से आसान एकीकरण
इनके लिए उपयुक्त
डेटा-आधारित ऐप्स बनाने वाले डेवलपर्स
सांख्यिकी के लिए शैक्षिक सॉफ्टवेयर
पूर्वानुमान मॉडलिंग का उपयोग करने वाले एप्लिकेशन
सांख्यिकीय विश्लेषण की आवश्यकता वाले मोबाइल एप्लिकेशन
मशीन लर्निंग फीचर्स को लागू करने वाली टीमें
विचार योग्य बातें
सांख्यिकीय अवधारणाओं के समझ की आवश्यकता है
गणितीय लाइब्रेरी के कारण ऐप आकार में वृद्धि हो सकती है
गैर-वास्तविक समय तीव्र संचालन के लिए उपयुक्त
मूल उदाहरणों के अलावा सीमित दस्तावेज़न
अत्यधिक बड़े डेटासेट के लिए अनुकूलित नहीं
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
statistics
Statistics package for easy and efficient data manipulation with built-in Bayesian Network (Bayes Net),
many mathematical functions and tools.
API Documentation
See the API Documentation for a full list of functions, classes and extension.
Usage
Numeric extension:
import'package:statistics/statistics.dart';
voidmain() {
var ns = [10, 20.0, 30];
print('ns: $ns');
var mean = ns.mean;
print('mean: $mean');
var sdv = ns.standardDeviation;
print('sdv: $sdv');
var squares = ns.square;
print('squares: $squares');
}
Bayesian Network, also known as Bayes Network, is a very important tool in understanding the dependency
among events and assigning probabilities to them.
Here's an example of how to build a BayesianNetwork.
import'package:statistics/statistics.dart';
voidmain(){
var bayesNet = BayesianNetwork('cancer');
// C (cancer) = T (true) ; F (false)
bayesNet.addVariable("C", [
'F',
'T',
], [], [
"C = F: 0.99",
"C = T: 0.01",
]);
// X (exam) = P (positive) ; N (negative)
bayesNet.addVariable("X", [
'+P',
'-N',
], [
"C"
], [
"X = N, C = F: 0.91",
"X = P, C = F: 0.09",
"X = N, C = T: 0.10",
"X = P, C = T: 0.90",
]);
// Show the network nodes and probabilities:print(bayesNet);
var analyser = bayesNet.analyser;
// Ask the probability to have cancer with a positive exame (X = P): var answer1 = analyser.ask('P(c|x)');
print(answer1); // P(c|x) -> C = T | X = P -> 0.09174311926605506 (0.009000000000000001) >> 917.43%// Ask the probability to have cancer with a negative exame (X = N):var answer2 = analyser.ask('P(c|-x)');
print(answer2); // P(c|-x) -> C = T | X = N -> 0.0011087703736556158 (0.001) >> 11.09%
}
Variable Dependency
To support variables dependencies you can use the method addDependency:
import'package:statistics/statistics.dart';
voidmain() {
// ** Note that this example is NOT USING REAL probabilities for Cancer!var bayesNet = BayesianNetwork('cancer');
// C (cancer) = T (true) ; F (false)
bayesNet.addVariable("C", [
'F',
'T',
], [], [
"C = F: 0.99",
"C = T: 0.01",
]);
// X (exam) = P (positive) ; N (negative)
bayesNet.addVariable("X", [
'+P',
'-N',
], [
"C"
], [
"X = N, C = F: 0.91",
"X = P, C = F: 0.09",
"X = N, C = T: 0.10",
"X = P, C = T: 0.90",
]);
// D (Doctor diagnosis) = P (positive) ; N (negative)
bayesNet.addVariable("D", [
'+P',
'-N',
], [
"C"
], [
"D = N, C = F: 0.99",
"D = P, C = F: 0.01",
"D = N, C = T: 0.75",
"D = P, C = T: 0.25",
]);
// Add dependency between D (Doctor diagnosis) and X (Exam),// where the probability of a correct diagnosis is improved:
bayesNet.addDependency([
'D',
'X'
], [
"D = N, X = N, C = F: 0.364",
"D = P, X = N, C = F: 0.546",
"D = N, X = P, C = F: 0.036",
"D = P, X = P, C = F: 0.054",
"D = N, X = N, C = T: 0.025",
"D = N, X = P, C = T: 0.075",
"D = P, X = N, C = T: 0.225",
"D = P, X = P, C = T: 0.675",
]);
// Show the network nodes and probabilities:print(bayesNet);
var analyser = bayesNet.analyser;
// Ask the probability to have cancer with a positive exame (X = P):var answer1 = analyser.ask('P(c|x)');
print(answer1); // P(c|x) -> C = T | X = P -> 0.09174311926605506 (0.009000000000000001) >> 917.43%// Ask the probability to have cancer with a negative exame (X = N):var answer2 = analyser.ask('P(c|-x)');
print(answer2); // P(c|-x) -> C = T | X = N -> 0.0011087703736556158 (0.001) >> 11.09%// Ask the probability to have cancer with a positive diagnosis from the Doctor (D = P):var answer3 = analyser.ask('P(c|d)');
print(answer3); // P(c|d) -> C = T | D = P -> 0.20161290322580644 (0.0025) >> 2016.13%// Ask the probability to have cancer with a negative diagnosis from the Doctor (D = N):var answer4 = analyser.ask('P(c|-d)');
print(answer4); // P(c|-d) -> C = T | D = N -> 0.007594167679222358 (0.0075) >> 75.94%// Ask the probability to have cancer with a positive diagnosis from the Doctor and a positive exame (D = P, X = P):var answer5 = analyser.ask('P(c|d,x)');
print(answer5); // P(c|d,x) -> C = T | D = P, X = P -> 0.11210762331838567 (0.006750000000000001) >> 1121.08%// Ask the probability to have cancer with a negative diagnosis from the Doctor and a negative exame (D = N, X = N):var answer6 = analyser.ask('P(c|-d,-x)');
print(answer6); // P(c|-d,-x) -> C = T | D = N, X = N -> 0.0006932697373894235 (0.00025) >> 6.93%
}
To help to generate the probabilities you can use the BayesEventMonitor class and
then build the BayesianNetwork:
import'package:statistics/statistics.dart';
voidmain() {
// Monitor events to then build a Bayesian Network:// ** Note that this example is NOT USING REAL probabilities for Cancer!var eventMonitor = BayesEventMonitor('cancer');
// The prevalence of Cancer in the population:// - 1% (10:990):for (var i = 0; i < 990; ++i) {
eventMonitor.notifyEvent(['CANCER=false']);
}
for (var i = 0; i < 10; ++i) {
eventMonitor.notifyEvent(['CANCER=true']);
}
// The Exam performance when the person have cancer:// - 90% Sensitivity.// - 10% false negative (1:9).for (var i = 0; i < 9; ++i) {
eventMonitor.notifyEvent(['EXAM=positive', 'CANCER=true']);
}
for (var i = 0; i < 1; ++i) {
eventMonitor.notifyEvent(['EXAM=negative', 'CANCER=true']);
}
// The Exam performance when the person doesn't have cancer:// - 91% Specificity// - 9% false positive (89:901).for (var i = 0; i < 901; ++i) {
eventMonitor.notifyEvent(['EXAM=negative', 'CANCER=false']);
}
for (var i = 0; i < 89; ++i) {
eventMonitor.notifyEvent(['EXAM=positive', 'CANCER=false']);
}
var bayesNet = eventMonitor.buildBayesianNetwork();
var analyser = bayesNet.analyser;
var answer1 = analyser.ask('P(cancer)');
print('- Cancer probability without an Exam:');
print(' $answer1'); // P(cancer) -> CANCER = TRUE | -> 0.01 >> 100.00%var answer2 = analyser.ask('P(cancer|exam)');
print('- Cancer probability with a positive Exam:');
print(' $answer2'); // P(cancer|exam) -> CANCER = TRUE | EXAM = POSITIVE -> 0.09183673469387756 (0.009000000000000001) >> 918.37%
}
To generate a CSV document, just use the extension generateCSV in your data collection.
You can pass the parameter separator to change the value separator (default: ,).
A decimal number with variable decimal precision. The precision can be defined in the constructor or is identified
automatically while parsing or converting a number to Decimal.
If an operation needs more precision to correctly represent a Decimal the precision will be expanded.
The internal representation uses a DynamicInt.
The main motivation of this high-Precision Arithmetic implementation is to have an internal representation that
avoid the use of BigInt unless is really needed, avoiding slow BigInt operations and extra memory. Also,
this implementation allows power with high precision and power with decimal exponents, what is not present
int many libraries.
Example:
import'package:statistics/statistics.dart';
voidmain(){
var n1 = DynamicInt.fromInt(123) + Decimal.parse('0.456');
print(n1); // 123.456var n2 = Decimal.parse('0.1') + Decimal.parse('0.2');
print(n2); // 0.3// Using `toDecimal` extension to convert an `int` to `Decimal`:var n3 = 123.toDecimal().powerInt(41); // power with an integer exponent. print(n3); // 48541095000524544750127162673405880068636916264012200797813591925035550682238127143323.0var n4 = 2.toDecimal().powerDouble(2.2); // power with a double exponent.print(n4); // 4.594793419988// Using `toDynamicInt` extension to convert an `int` to `DynamicInt`:var n5 = 2.toDynamicInt().powerInt(-1); // power with a negative exponent.print(n5); // 0.5
}
See the API Documentation for a full list of functions, extension and classes.
data_serializer
The statistics package exports the package data_serializer to help the handling of primitives, data, bytes and files.
Some extension in data_serializer were originally in the statistics package.
Test Coverage
This package aims to always have a high test coverage percentage, over 95%.
With that the package can be a reliable tool to support your important projects.