This commit is contained in:
Yunusov_Niyaz 2024-09-30 23:02:17 +04:00
commit 3a08804aff
19 changed files with 49715 additions and 0 deletions

278
.gitignore vendored Normal file
View File

@ -0,0 +1,278 @@
# Created by https://www.toptal.com/developers/gitignore/api/python,pycharm+all
# Edit at https://www.toptal.com/developers/gitignore?templates=python,pycharm+all
### PyCharm+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### PyCharm+all Patch ###
# Ignores the whole .idea folder and all .iml files
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
.idea/*
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
*.iml
modules.xml
.idea/misc.xml
*.ipr
# Sonarlint plugin
.idea/sonarlint
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
# End of https://www.toptal.com/developers/gitignore/api/python,pycharm+all
# JS
node_modules/
test.csv

13
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,13 @@
{
"recommendations": [
"ms-python.black-formatter",
"ms-python.flake8",
"ms-python.isort",
"ms-toolsai.jupyter",
"ms-toolsai.datawrangler",
"ms-python.python",
"donjayamanne.python-environment-manager",
// optional
"usernamehw.errorlens"
]
}

16
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "mai-service",
"type": "debugpy",
"request": "launch",
"program": "run.py",
"console": "integratedTerminal",
"justMyCode": true
}
]
}

38
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,38 @@
{
"files.autoSave": "onFocusChange",
"files.exclude": {
"**/__pycache__": true
},
"editor.detectIndentation": false,
"editor.formatOnType": false,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
"source.sortImports": "explicit"
},
"editor.stickyScroll.enabled": false,
"diffEditor.ignoreTrimWhitespace": false,
"debug.showVariableTypes": true,
"workbench.editor.highlightModifiedTabs": true,
"git.suggestSmartCommit": false,
"git.autofetch": true,
"git.openRepositoryInParentFolders": "always",
"git.confirmSync": false,
"errorLens.gutterIconsEnabled": true,
"errorLens.messageEnabled": false,
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
},
"python.languageServer": "Pylance",
"python.analysis.typeCheckingMode": "basic",
"python.analysis.autoImportCompletions": true,
"isort.args": [
"--profile",
"black"
],
"notebook.lineNumbers": "on",
"notebook.output.minimalErrorRendering": true,
}

52
backend/__init__.py Normal file
View File

@ -0,0 +1,52 @@
import importlib
import os
import traceback
import matplotlib
from apiflask import APIBlueprint, APIFlask
from flask_cors import CORS
matplotlib.use("agg")
cors = CORS()
api_bp = APIBlueprint("api", __name__, url_prefix="/api/v1")
dataset_path: str | None = None
class Config:
SECRET_KEY = "secret!"
SEND_FILE_MAX_AGE_DEFAULT = -1
def create_app():
global dataset_path
# Create and configure app
app = APIFlask(
"MAI Service",
title="MAI Service API",
docs_path="/",
version="1.0",
static_folder="",
template_folder="",
)
app.config.from_object(Config)
dataset_path = os.path.join(app.instance_path, "dataset")
os.makedirs(dataset_path, exist_ok=True)
@app.errorhandler(Exception)
def my_error_processor(error):
traceback.print_exception(error)
return {"message": str(error), "detail": "No details"}, 500
# Import custom REST methods
importlib.import_module("backend.api")
# Enable REST API
app.register_blueprint(api_bp)
# Enable app extensions
cors.init_app(app)
return app

57
backend/api.py Normal file
View File

@ -0,0 +1,57 @@
from apiflask import FileSchema, Schema, fields
from flask import send_file
from backend import api_bp, dataset_path
from backend.service import Service
class FileUpload(Schema):
file = fields.File(required=True)
class ColumnInfoDto(Schema):
datatype = fields.String()
items = fields.List(fields.String())
class TableColumnDto(Schema):
name = fields.String()
datatype = fields.String()
items = fields.List(fields.String())
service = Service(dataset_path)
@api_bp.post("/dataset")
@api_bp.input(FileUpload, location="files")
def upload_dataset(files_data):
uploaded_file = files_data["file"]
return service.upload_dataset(uploaded_file)
@api_bp.get("/dataset")
def get_all_datasets():
return service.get_all_datasets()
@api_bp.get("/dataset/<string:name>")
@api_bp.output(TableColumnDto(many=True))
def get_dataset_info(name: str):
return service.get_dataset_info(name)
@api_bp.get("/dataset/<string:name>/<string:column>")
@api_bp.output(ColumnInfoDto)
def get_column_info(name: str, column: str):
return service.get_column_info(name, column)
@api_bp.get("/dataset/draw/hist/<string:name>/<string:column>")
@api_bp.output(
FileSchema(type="string", format="binary"), content_type="image/png", example=""
)
def get_dataset_hist(name: str, column: str):
data = service.get_hist(name, column)
data.seek(0)
return send_file(data, download_name=f"{name}.hist.png", mimetype="image/png")

59
backend/service.py Normal file
View File

@ -0,0 +1,59 @@
import io
import os
import pathlib
from typing import BinaryIO, Dict, List
import pandas as pd
from matplotlib.figure import Figure
from werkzeug.datastructures import FileStorage
from werkzeug.utils import secure_filename
class Service:
def __init__(self, dataset_path: str | None) -> None:
if dataset_path is None:
raise Exception("Dataset path is not defined")
self.__path: str = dataset_path
def __get_dataset(self, filename: str) -> pd.DataFrame:
full_file_name = os.path.join(self.__path, secure_filename(filename))
return pd.read_csv(full_file_name)
def upload_dataset(self, file: FileStorage) -> str:
if file.filename is None:
raise Exception("Dataset upload error")
file_name: str = file.filename
full_file_name = os.path.join(self.__path, secure_filename(file_name))
file.save(full_file_name)
return file_name
def get_all_datasets(self) -> List[str]:
return [file.name for file in pathlib.Path(self.__path).glob("*.csv")]
def get_dataset_info(self, filename) -> List[Dict]:
dataset = self.__get_dataset(filename)
dataset_info = []
for column in dataset.columns:
items = dataset[column].astype(str)
column_info = {
"name": column,
"datatype": dataset.dtypes[column],
"items": items,
}
dataset_info.append(column_info)
return dataset_info
def get_column_info(self, filename, column) -> Dict:
dataset = self.__get_dataset(filename)
datatype = dataset.dtypes[column]
items = sorted(dataset[column].astype(str).unique())
return {"datatype": datatype, "items": items}
def get_hist(self, filename, column) -> BinaryIO:
dataset = self.__get_dataset(filename)
bytes = io.BytesIO()
plot: Figure | None = dataset.plot.hist(column=[column], bins=80).get_figure()
if plot is None:
raise Exception("Can't create hist plot")
plot.savefig(bytes, dpi=300, format="png")
return bytes

19238
data/car_price_prediction.csv Normal file

File diff suppressed because it is too large Load Diff

21614
data/kc_house_data.csv Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,236 @@
ID,Country (or dependency),Population 2020,Yearly Change,Net Change,Density (P/Km²),Land Area (Km²),Migrants (net),Fert. Rate,Med. Age,Urban Pop %,World Share
1,China,"1,439,323,776",0.39%,"5,540,090",153,"9,388,211","-348,399",1.7,38,61%,18.47%
2,India,"1,380,004,385",0.99%,"13,586,631",464,"2,973,190","-532,687",2.2,28,35%,17.70%
3,United States,"331,002,651",0.59%,"1,937,734",36,"9,147,420","954,806",1.8,38,83%,4.25%
4,Indonesia,"273,523,615",1.07%,"2,898,047",151,"1,811,570","-98,955",2.3,30,56%,3.51%
5,Pakistan,"220,892,340",2.00%,"4,327,022",287,"770,880","-233,379",3.6,23,35%,2.83%
6,Brazil,"212,559,417",0.72%,"1,509,890",25,"8,358,140","21,200",1.7,33,88%,2.73%
7,Nigeria,"206,139,589",2.58%,"5,175,990",226,"910,770","-60,000",5.4,18,52%,2.64%
8,Bangladesh,"164,689,383",1.01%,"1,643,222","1,265","130,170","-369,501",2.1,28,39%,2.11%
9,Russia,"145,934,462",0.04%,"62,206",9,"16,376,870","182,456",1.8,40,74%,1.87%
10,Mexico,"128,932,753",1.06%,"1,357,224",66,"1,943,950","-60,000",2.1,29,84%,1.65%
11,Japan,"126,476,461",-0.30%,"-383,840",347,"364,555","71,560",1.4,48,92%,1.62%
12,Ethiopia,"114,963,588",2.57%,"2,884,858",115,"1,000,000","30,000",4.3,19,21%,1.47%
13,Philippines,"109,581,078",1.35%,"1,464,463",368,"298,170","-67,152",2.6,26,47%,1.41%
14,Egypt,"102,334,404",1.94%,"1,946,331",103,"995,450","-38,033",3.3,25,43%,1.31%
15,Vietnam,"97,338,579",0.91%,"876,473",314,"310,070","-80,000",2.1,32,38%,1.25%
16,DR Congo,"89,561,403",3.19%,"2,770,836",40,"2,267,050","23,861",6,17,46%,1.15%
17,Turkey,"84,339,067",1.09%,"909,452",110,"769,630","283,922",2.1,32,76%,1.08%
18,Iran,"83,992,949",1.30%,"1,079,043",52,"1,628,550","-55,000",2.2,32,76%,1.08%
19,Germany,"83,783,942",0.32%,"266,897",240,"348,560","543,822",1.6,46,76%,1.07%
20,Thailand,"69,799,978",0.25%,"174,396",137,"510,890","19,444",1.5,40,51%,0.90%
21,United Kingdom,"67,886,011",0.53%,"355,839",,"241,930","260,650",1.8,40,83%,0.87%
22,France,"65,273,511",0.22%,"143,783",119,"547,557","36,527",1.9,42,82%,0.84%
23,Italy,"60,461,826",-0.15%,"-88,249",206,"294,140","148,943",1.3,47,69%,0.78%
24,Tanzania,"59,734,218",2.98%,"1,728,755",67,"885,800","-40,076",4.9,18,37%,0.77%
25,South Africa,"59,308,690",1.28%,"750,420",49,"1,213,090","145,405",2.4,28,67%,0.76%
26,Myanmar,"54,409,800",0.67%,"364,380",83,"653,290","-163,313",2.2,29,31%,0.70%
27,Kenya,"53,771,296",2.28%,"1,197,323",94,"569,140","-10,000",3.5,20,28%,0.69%
28,South Korea,"51,269,185",0.09%,"43,877",527,"97,230","11,731",1.1,44,82%,0.66%
29,Colombia,"50,882,891",1.08%,"543,448",46,"1,109,500","204,796",1.8,31,80%,0.65%
30,Spain,"46,754,778",0.04%,"18,002",94,"498,800","40,000",1.3,45,80%,0.60%
31,Uganda,"45,741,007",3.32%,"1,471,413",229,"199,810","168,694",5,17,26%,0.59%
32,Argentina,"45,195,774",0.93%,"415,097",17,"2,736,690","4,800",2.3,32,93%,0.58%
33,Algeria,"43,851,044",1.85%,"797,990",18,"2,381,740","-10,000",3.1,29,73%,0.56%
34,Sudan,"43,849,260",2.42%,"1,036,022",25,"1,765,048","-50,000",4.4,20,35%,0.56%
35,Ukraine,"43,733,762",-0.59%,"-259,876",75,"579,320","10,000",1.4,41,69%,0.56%
36,Iraq,"40,222,493",2.32%,"912,710",93,"434,320","7,834",3.7,21,73%,0.52%
37,Afghanistan,"38,928,346",2.33%,"886,592",60,"652,860","-62,920",4.6,18,25%,0.50%
38,Poland,"37,846,611",-0.11%,"-41,157",124,"306,230","-29,395",1.4,42,60%,0.49%
39,Canada,"37,742,154",0.89%,"331,107",4,"9,093,510","242,032",1.5,41,81%,0.48%
40,Morocco,"36,910,560",1.20%,"438,791",83,"446,300","-51,419",2.4,30,64%,0.47%
41,Saudi Arabia,"34,813,871",1.59%,"545,343",16,"2,149,690","134,979",2.3,32,84%,0.45%
42,Uzbekistan,"33,469,203",1.48%,"487,487",79,"425,400","-8,863",2.4,28,50%,0.43%
43,Peru,"32,971,854",1.42%,"461,401",26,"1,280,000","99,069",2.3,31,79%,0.42%
44,Angola,"32,866,272",3.27%,"1,040,977",26,"1,246,700","6,413",5.6,17,67%,0.42%
45,Malaysia,"32,365,999",1.30%,"416,222",99,"328,550","50,000",2,30,78%,0.42%
46,Mozambique,"31,255,435",2.93%,"889,399",,"786,380","-5,000",4.9,18,38%,0.40%
47,Ghana,"31,072,940",2.15%,"655,084",137,"227,540","-10,000",3.9,22,57%,0.40%
48,Yemen,"29,825,964",2.28%,"664,042",56,"527,970","-30,000",3.8,20,38%,0.38%
49,Nepal,"29,136,808",1.85%,"528,098",203,"143,350","41,710",1.9,25,21%,0.37%
50,Venezuela,"28,435,940",-0.28%,"-79,889",32,"882,050","-653,249",2.3,30,N.A.,0.36%
51,Madagascar,"27,691,018",2.68%,"721,711",48,"581,795","-1,500",4.1,20,39%,0.36%
52,Cameroon,"26,545,863",2.59%,"669,483",56,"472,710","-4,800",4.6,19,56%,0.34%
53,Côte d'Ivoire,"26,378,274",2.57%,"661,730",83,"318,000","-8,000",4.7,19,51%,0.34%
54,North Korea,"25,778,816",0.44%,"112,655",214,"120,410","-5,403",1.9,35,63%,0.33%
55,Australia,"25,499,884",1.18%,"296,686",3,"7,682,300","158,246",1.8,38,86%,0.33%
56,Niger,"24,206,644",3.84%,"895,929",19,"1,266,700","4,000",7,15,17%,0.31%
57,Taiwan,"23,816,775",0.18%,"42,899",673,"35,410","30,001",1.2,42,79%,0.31%
58,Sri Lanka,"21,413,249",0.42%,"89,516",341,"62,710","-97,986",2.2,34,18%,0.27%
59,Burkina Faso,"20,903,273",2.86%,"581,895",76,"273,600","-25,000",5.2,18,31%,0.27%
60,Mali,"20,250,833",3.02%,"592,802",17,"1,220,190","-40,000",5.9,16,44%,0.26%
61,Romania,"19,237,691",-0.66%,"-126,866",84,"230,170","-73,999",1.6,43,55%,0.25%
62,Malawi,"19,129,952",2.69%,"501,205",203,"94,280","-16,053",4.3,18,18%,0.25%
63,Chile,"19,116,201",0.87%,"164,163",26,"743,532","111,708",1.7,35,85%,0.25%
64,Kazakhstan,"18,776,707",1.21%,"225,280",7,"2,699,700","-18,000",2.8,31,58%,0.24%
65,Zambia,"18,383,955",2.93%,"522,925",25,"743,390","-8,000",4.7,18,45%,0.24%
66,Guatemala,"17,915,568",1.90%,"334,096",167,"107,160","-9,215",2.9,23,52%,0.23%
67,Ecuador,"17,643,054",1.55%,"269,392",71,"248,360","36,400",2.4,28,63%,0.23%
68,Syria,"17,500,658",2.52%,"430,523",95,"183,630","-427,391",2.8,26,60%,0.22%
69,Netherlands,"17,134,872",0.22%,"37,742",508,"33,720","16,000",1.7,43,92%,0.22%
70,Senegal,"16,743,927",2.75%,"447,563",87,"192,530","-20,000",4.7,19,49%,0.21%
71,Cambodia,"16,718,965",1.41%,"232,423",95,"176,520","-30,000",2.5,26,24%,0.21%
72,Chad,"16,425,864",3.00%,"478,988",13,"1,259,200","2,000",5.8,17,23%,0.21%
73,Somalia,"15,893,222",2.92%,"450,317",25,"627,340","-40,000",6.1,17,47%,0.20%
74,Zimbabwe,"14,862,924",1.48%,"217,456",38,"386,850","-116,858",3.6,19,38%,0.19%
75,Guinea,"13,132,795",2.83%,"361,549",53,"245,720","-4,000",4.7,18,39%,0.17%
76,Rwanda,"12,952,218",2.58%,"325,268",525,"24,670","-9,000",4.1,20,18%,0.17%
77,Benin,"12,123,200",2.73%,"322,049",108,"112,760","-2,000",4.9,19,48%,0.16%
78,Burundi,"11,890,784",3.12%,"360,204",463,"25,680","2,001",5.5,17,14%,0.15%
79,Tunisia,"11,818,619",1.06%,"123,900",76,"155,360","-4,000",2.2,33,70%,0.15%
80,Bolivia,"11,673,021",1.39%,"159,921",11,"1,083,300","-9,504",2.8,26,69%,0.15%
81,Belgium,"11,589,623",0.44%,"50,295",383,"30,280","48,000",1.7,42,98%,0.15%
82,Haiti,"11,402,528",1.24%,"139,451",414,"27,560","-35,000",3,24,57%,0.15%
83,Cuba,"11,326,616",-0.06%,"-6,867",106,"106,440","-14,400",1.6,42,78%,0.15%
84,South Sudan,"11,193,725",1.19%,"131,612",18,"610,952","-174,200",4.7,19,25%,0.14%
85,Dominican Republic,"10,847,910",1.01%,"108,952",225,"48,320","-30,000",2.4,28,85%,0.14%
86,Czech Republic (Czechia),"10,708,981",0.18%,"19,772",139,"77,240","22,011",1.6,43,74%,0.14%
87,Greece,"10,423,054",-0.48%,"-50,401",,"128,900","-16,000",1.3,46,85%,0.13%
88,Jordan,"10,203,134",1.00%,"101,440",115,"88,780","10,220",2.8,24,91%,0.13%
89,Portugal,"10,196,709",-0.29%,"-29,478",111,"91,590","-6,000",1.3,46,66%,0.13%
90,Azerbaijan,"10,139,177",0.91%,"91,459",123,"82,658","1,200",2.1,32,56%,0.13%
91,Sweden,"10,099,265",0.63%,"62,886",25,"410,340","40,000",1.9,41,88%,0.13%
92,Honduras,"9,904,607",1.63%,"158,490",89,"111,890","-6,800",2.5,24,57%,0.13%
93,United Arab Emirates,"9,890,402",1.23%,"119,873",118,"83,600","40,000",1.4,33,86%,0.13%
94,Hungary,"9,660,351",-0.25%,"-24,328",107,"90,530","6,000",1.5,43,72%,0.12%
95,Tajikistan,"9,537,645",2.32%,"216,627",68,"139,960","-20,000",3.6,22,27%,0.12%
96,Belarus,"9,449,323",-0.03%,"-3,088",47,"202,910","8,730",1.7,40,79%,0.12%
97,Austria,"9,006,398",0.57%,"51,296",109,"82,409","65,000",1.5,43,57%,0.12%
98,Papua New Guinea,"8,947,024",1.95%,"170,915",20,"452,860",-800,3.6,22,13%,0.11%
99,Serbia,"8,737,371",-0.40%,"-34,864",100,"87,460","4,000",1.5,42,56%,0.11%
100,Israel,"8,655,535",1.60%,"136,158",400,"21,640","10,000",3,30,93%,0.11%
101,Switzerland,"8,654,622",0.74%,"63,257",219,"39,516","52,000",1.5,43,74%,0.11%
102,Togo,"8,278,724",2.43%,"196,358",152,"54,390","-2,000",4.4,19,43%,0.11%
103,Sierra Leone,"7,976,983",2.10%,"163,768",111,"72,180","-4,200",4.3,19,43%,0.10%
104,Hong Kong,"7,496,981",0.82%,"60,827","7,140","1,050","29,308",1.3,45,N.A.,0.10%
105,Laos,"7,275,560",1.48%,"106,105",32,"230,800","-14,704",2.7,24,36%,0.09%
106,Paraguay,"7,132,538",1.25%,"87,902",18,"397,300","-16,556",2.4,26,62%,0.09%
107,Bulgaria,"6,948,445",-0.74%,"-51,674",64,"108,560","-4,800",1.6,45,76%,0.09%
108,Libya,"6,871,292",1.38%,"93,840",4,"1,759,540","-1,999",2.3,29,78%,0.09%
109,Lebanon,"6,825,445",-0.44%,"-30,268",667,"10,230","-30,012",2.1,30,78%,0.09%
110,Nicaragua,"6,624,554",1.21%,"79,052",55,"120,340","-21,272",2.4,26,57%,0.08%
111,Kyrgyzstan,"6,524,195",1.69%,"108,345",34,"191,800","-4,000",3,26,36%,0.08%
112,El Salvador,"6,486,205",0.51%,"32,652",313,"20,720","-40,539",2.1,28,73%,0.08%
113,Turkmenistan,"6,031,200",1.50%,"89,111",13,"469,930","-5,000",2.8,27,53%,0.08%
114,Singapore,"5,850,342",0.79%,"46,005","",700,"27,028",1.2,42,N.A.,0.08%
115,Denmark,"5,792,202",0.35%,"20,326",137,"42,430","15,200",1.8,42,88%,0.07%
116,Finland,"5,540,720",0.15%,"8,564",18,"303,890","14,000",1.5,43,86%,0.07%
117,Congo,"5,518,087",2.56%,"137,579",16,"341,500","-4,000",4.5,19,70%,0.07%
118,Slovakia,"5,459,642",0.05%,"2,629",114,"48,088","1,485",1.5,41,54%,0.07%
119,Norway,"5,421,241",0.79%,"42,384",15,"365,268","28,000",1.7,40,83%,0.07%
120,Oman,"5,106,626",2.65%,"131,640",16,"309,500","87,400",2.9,31,87%,0.07%
121,State of Palestine,"5,101,414",2.41%,"119,994",847,"6,020","-10,563",3.7,21,80%,0.07%
122,Costa Rica,"5,094,118",0.92%,"46,557",100,"51,060","4,200",1.8,33,80%,0.07%
123,Liberia,"5,057,681",2.44%,"120,307",53,"96,320","-5,000",4.4,19,53%,0.06%
124,Ireland,"4,937,786",1.13%,"55,291",72,"68,890","23,604",1.8,38,63%,0.06%
125,Central African Republic,"4,829,767",1.78%,"84,582",8,"622,980","-40,000",4.8,18,43%,0.06%
126,New Zealand,"4,822,233",0.82%,"39,170",18,"263,310","14,881",1.9,38,87%,0.06%
127,Mauritania,"4,649,658",2.74%,"123,962",5,"1,030,700","5,000",4.6,20,57%,0.06%
128,Panama,"4,314,767",1.61%,"68,328",58,"74,340","11,200",2.5,30,68%,0.06%
129,Kuwait,"4,270,571",1.51%,"63,488",240,"17,820","39,520",2.1,37,N.A.,0.05%
130,Croatia,"4,105,267",-0.61%,"-25,037",73,"55,960","-8,001",1.4,44,58%,0.05%
131,Moldova,"4,033,963",-0.23%,"-9,300",123,"32,850","-1,387",1.3,38,43%,0.05%
132,Georgia,"3,989,167",-0.19%,"-7,598",57,"69,490","-10,000",2.1,38,58%,0.05%
133,Eritrea,"3,546,421",1.41%,"49,304",35,"101,000","-39,858",4.1,19,63%,0.05%
134,Uruguay,"3,473,730",0.35%,"11,996",20,"175,020","-3,000",2,36,96%,0.04%
135,Bosnia and Herzegovina,"3,280,819",-0.61%,"-20,181",64,"51,000","-21,585",1.3,43,52%,0.04%
136,Mongolia,"3,278,290",1.65%,"53,123",2,"1,553,560",-852,2.9,28,67%,0.04%
137,Armenia,"2,963,243",0.19%,"5,512",104,"28,470","-4,998",1.8,35,63%,0.04%
138,Jamaica,"2,961,167",0.44%,"12,888",273,"10,830","-11,332",2,31,55%,0.04%
139,Qatar,"2,881,053",1.73%,"48,986",248,"11,610","40,000",1.9,32,96%,0.04%
140,Albania,"2,877,797",-0.11%,"-3,120",105,"27,400","-14,000",1.6,36,63%,0.04%
141,Puerto Rico,"2,860,853",-2.47%,"-72,555",323,"8,870","-97,986",1.2,44,N.A.,0.04%
142,Lithuania,"2,722,289",-1.35%,"-37,338",43,"62,674","-32,780",1.7,45,71%,0.03%
143,Namibia,"2,540,905",1.86%,"46,375",3,"823,290","-4,806",3.4,22,55%,0.03%
144,Gambia,"2,416,668",2.94%,"68,962",239,"10,120","-3,087",5.3,18,59%,0.03%
145,Botswana,"2,351,627",2.08%,"47,930",4,"566,730","3,000",2.9,24,73%,0.03%
146,Gabon,"2,225,734",2.45%,"53,155",9,"257,670","3,260",4,23,87%,0.03%
147,Lesotho,"2,142,249",0.80%,"16,981",71,"30,360","-10,047",3.2,24,31%,0.03%
148,North Macedonia,"2,083,374",0.00%,-85,83,"25,220","-1,000",1.5,39,59%,0.03%
149,Slovenia,"2,078,938",0.01%,284,103,"20,140","2,000",1.6,45,55%,0.03%
150,Guinea-Bissau,"1,968,001",2.45%,"47,079",70,"28,120","-1,399",4.5,19,45%,0.03%
151,Latvia,"1,886,198",-1.08%,"-20,545",30,"62,200","-14,837",1.7,44,69%,0.02%
152,Bahrain,"1,701,575",3.68%,"60,403","2,239",760,"47,800",2,32,89%,0.02%
153,Equatorial Guinea,"1,402,985",3.47%,"46,999",50,"28,050","16,000",4.6,22,73%,0.02%
154,Trinidad and Tobago,"1,399,488",0.32%,"4,515",273,"5,130",-800,1.7,36,52%,0.02%
155,Estonia,"1,326,535",0.07%,887,31,"42,390","3,911",1.6,42,68%,0.02%
156,Timor-Leste,"1,318,445",1.96%,"25,326",89,"14,870","-5,385",4.1,21,33%,0.02%
157,Mauritius,"1,271,768",0.17%,"2,100",626,"2,030",0,1.4,37,41%,0.02%
158,Cyprus,"1,207,359",0.73%,"8,784",131,"9,240","5,000",1.3,37,67%,0.02%
159,Eswatini,"1,160,164",1.05%,"12,034",67,"17,200","-8,353",3,21,30%,0.01%
160,Djibouti,"988,000",1.48%,"14,440",43,"23,180",900,2.8,27,79%,0.01%
161,Fiji,"896,445",0.73%,"6,492",49,"18,270","-6,202",2.8,28,59%,0.01%
162,Réunion,"895,312",0.72%,"6,385",358,"2,500","-1,256",2.3,36,100%,0.01%
163,Comoros,"869,601",2.20%,"18,715",467,"1,861","-2,000",4.2,20,29%,0.01%
164,Guyana,"786,552",0.48%,"3,786",4,"196,850","-6,000",2.5,27,27%,0.01%
165,Bhutan,"771,608",1.12%,"8,516",20,"38,117",320,2,28,46%,0.01%
166,Solomon Islands,"686,884",2.55%,"17,061",25,"27,990","-1,600",4.4,20,23%,0.01%
167,Macao,"649,335",1.39%,"8,890","21,645",30,"5,000",1.2,39,N.A.,0.01%
168,Montenegro,"628,066",0.01%,79,47,"13,450",-480,1.8,39,68%,0.01%
169,Luxembourg,"625,978",1.66%,"10,249",242,"2,590","9,741",1.5,40,88%,0.01%
170,Western Sahara,"597,339",2.55%,"14,876",2,"266,000","5,582",2.4,28,87%,0.01%
171,Suriname,"586,632",0.90%,"5,260",4,"156,000","-1,000",2.4,29,65%,0.01%
172,Cabo Verde,"555,987",1.10%,"6,052",138,"4,030","-1,342",2.3,28,68%,0.01%
173,Micronesia,"548,914",1.00%,"5,428",784,700,"-2,957",2.9,27,68%,0.01%
174,Maldives,"540,544",1.81%,"9,591","1,802",300,"11,370",1.9,30,35%,0.01%
175,Malta,"441,543",0.27%,"1,171","1,380",320,900,1.5,43,93%,0.01%
176,Brunei,"437,479",0.97%,"4,194",83,"5,270",0,1.8,32,80%,0.01%
177,Guadeloupe,"400,124",0.02%,68,237,"1,690","-1,440",2.2,44,N.A.,0.01%
178,Belize,"397,628",1.86%,"7,275",17,"22,810","1,200",2.3,25,46%,0.01%
179,Bahamas,"393,244",0.97%,"3,762",39,"10,010","1,000",1.8,32,86%,0.01%
180,Martinique,"375,265",-0.08%,-289,354,"1,060",-960,1.9,47,92%,0.00%
181,Iceland,"341,243",0.65%,"2,212",3,"100,250",380,1.8,37,94%,0.00%
182,Vanuatu,"307,145",2.42%,"7,263",25,"12,190",120,3.8,21,24%,0.00%
183,French Guiana,"298,682",2.70%,"7,850",4,"82,200","1,200",3.4,25,87%,0.00%
184,Barbados,"287,375",0.12%,350,668,430,-79,1.6,40,31%,0.00%
185,New Caledonia,"285,498",0.97%,"2,748",16,"18,280",502,2,34,72%,0.00%
186,French Polynesia,"280,908",0.58%,"1,621",77,"3,660","-1,000",2,34,64%,0.00%
187,Mayotte,"272,815",2.50%,"6,665",728,375,0,3.7,20,46%,0.00%
188,Sao Tome & Principe,"219,159",1.91%,"4,103",228,960,"-1,680",4.4,19,74%,0.00%
189,Samoa,"198,414",0.67%,"1,317",70,"2,830","-2,803",3.9,22,18%,0.00%
190,Saint Lucia,"183,627",0.46%,837,301,610,0,1.4,34,19%,0.00%
191,Channel Islands,"173,863",0.93%,"1,604",915,190,"1,351",1.5,43,30%,0.00%
192,Guam,"168,775",0.89%,"1,481",313,540,-506,2.3,31,95%,0.00%
193,Curaçao,"164,093",0.41%,669,,444,515,1.8,42,89%,0.00%
194,Kiribati,"119,449",1.57%,"1,843",147,810,-800,3.6,23,57%,0.00%
195,Grenada,"112,523",0.46%,520,331,340,-200,2.1,32,35%,0.00%
196,St. Vincent & Grenadines,"110,940",0.32%,351,284,390,-200,1.9,33,53%,0.00%
197,Aruba,"106,766",0.43%,452,593,180,201,1.9,41,44%,0.00%
198,Tonga,"105,695",1.15%,"1,201",147,720,-800,3.6,22,24%,0.00%
199,U.S. Virgin Islands,"104,425",-0.15%,-153,298,350,-451,2,43,96%,0.00%
200,Seychelles,"98,347",0.62%,608,214,460,-200,2.5,34,56%,0.00%
201,Antigua and Barbuda,"97,929",0.84%,811,223,440,0,2,34,26%,0.00%
202,Isle of Man,"85,033",0.53%,449,149,570,,N.A.,N.A.,53%,0.00%
203,Andorra,"77,265",0.16%,123,164,470,,N.A.,N.A.,88%,0.00%
204,Dominica,"71,986",0.25%,178,96,750,,N.A.,N.A.,74%,0.00%
205,Cayman Islands,"65,722",1.19%,774,274,240,,N.A.,N.A.,97%,0.00%
206,Bermuda,"62,278",-0.36%,-228,"1,246",50,,N.A.,N.A.,97%,0.00%
207,Marshall Islands,"59,190",0.68%,399,329,180,,N.A.,N.A.,70%,0.00%
208,Northern Mariana Islands,"57,559",0.60%,343,125,460,,N.A.,N.A.,88%,0.00%
209,Greenland,"56,770",0.17%,98,0,"410,450",,N.A.,N.A.,87%,0.00%
210,American Samoa,"55,191",-0.22%,-121,276,200,,N.A.,N.A.,88%,0.00%
211,Saint Kitts & Nevis,"53,199",0.71%,376,205,260,,N.A.,N.A.,33%,0.00%
212,Faeroe Islands,"48,863",0.38%,185,35,"1,396",,N.A.,N.A.,43%,0.00%
213,Sint Maarten,"42,876",1.15%,488,"1,261",34,,N.A.,N.A.,96%,0.00%
214,Monaco,"39,242",0.71%,278,"26,337",1,,N.A.,N.A.,N.A.,0.00%
215,Turks and Caicos,"38,717",1.38%,526,41,950,,N.A.,N.A.,89%,0.00%
216,Saint Martin,"38,666",1.75%,664,730,53,,N.A.,N.A.,0%,0.00%
217,Liechtenstein,"38,128",0.29%,109,238,160,,N.A.,N.A.,15%,0.00%
218,San Marino,"33,931",0.21%,71,566,60,,N.A.,N.A.,97%,0.00%
219,Gibraltar,"33,691",-0.03%,-10,"3,369",10,,N.A.,N.A.,N.A.,0.00%
220,British Virgin Islands,"30,231",0.67%,201,202,150,,N.A.,N.A.,52%,0.00%
221,Caribbean Netherlands,"26,223",0.94%,244,80,328,,N.A.,N.A.,75%,0.00%
222,Palau,"18,094",0.48%,86,39,460,,N.A.,N.A.,N.A.,0.00%
223,Cook Islands,"17,564",0.09%,16,73,240,,N.A.,N.A.,75%,0.00%
224,Anguilla,"15,003",0.90%,134,167,90,,N.A.,N.A.,N.A.,0.00%
225,Tuvalu,"11,792",1.25%,146,393,30,,N.A.,N.A.,62%,0.00%
226,Wallis & Futuna,"11,239",-1.69%,-193,80,140,,N.A.,N.A.,0%,0.00%
227,Nauru,"10,824",0.63%,68,541,20,,N.A.,N.A.,N.A.,0.00%
228,Saint Barthelemy,"9,877",0.30%,30,470,21,,N.A.,N.A.,0%,0.00%
229,Saint Helena,"6,077",0.30%,18,16,390,,N.A.,N.A.,27%,0.00%
230,Saint Pierre & Miquelon,"5,794",-0.48%,-28,25,230,,N.A.,N.A.,100%,0.00%
231,Montserrat,"4,992",0.06%,3,50,100,,N.A.,N.A.,10%,0.00%
232,Falkland Islands,"3,480",3.05%,103,0,"12,170",,N.A.,N.A.,66%,0.00%
233,Niue,"1,626",0.68%,11,6,260,,N.A.,N.A.,46%,0.00%
234,Tokelau,"1,357",1.27%,17,136,10,,N.A.,N.A.,0%,0.00%
235,Holy See,801,0.25%,2,"2,003",0,,N.A.,N.A.,N.A.,0.00%
1 ID Country (or dependency) Population 2020 Yearly Change Net Change Density (P/Km²) Land Area (Km²) Migrants (net) Fert. Rate Med. Age Urban Pop % World Share
2 1 China 1,439,323,776 0.39% 5,540,090 153 9,388,211 -348,399 1.7 38 61% 18.47%
3 2 India 1,380,004,385 0.99% 13,586,631 464 2,973,190 -532,687 2.2 28 35% 17.70%
4 3 United States 331,002,651 0.59% 1,937,734 36 9,147,420 954,806 1.8 38 83% 4.25%
5 4 Indonesia 273,523,615 1.07% 2,898,047 151 1,811,570 -98,955 2.3 30 56% 3.51%
6 5 Pakistan 220,892,340 2.00% 4,327,022 287 770,880 -233,379 3.6 23 35% 2.83%
7 6 Brazil 212,559,417 0.72% 1,509,890 25 8,358,140 21,200 1.7 33 88% 2.73%
8 7 Nigeria 206,139,589 2.58% 5,175,990 226 910,770 -60,000 5.4 18 52% 2.64%
9 8 Bangladesh 164,689,383 1.01% 1,643,222 1,265 130,170 -369,501 2.1 28 39% 2.11%
10 9 Russia 145,934,462 0.04% 62,206 9 16,376,870 182,456 1.8 40 74% 1.87%
11 10 Mexico 128,932,753 1.06% 1,357,224 66 1,943,950 -60,000 2.1 29 84% 1.65%
12 11 Japan 126,476,461 -0.30% -383,840 347 364,555 71,560 1.4 48 92% 1.62%
13 12 Ethiopia 114,963,588 2.57% 2,884,858 115 1,000,000 30,000 4.3 19 21% 1.47%
14 13 Philippines 109,581,078 1.35% 1,464,463 368 298,170 -67,152 2.6 26 47% 1.41%
15 14 Egypt 102,334,404 1.94% 1,946,331 103 995,450 -38,033 3.3 25 43% 1.31%
16 15 Vietnam 97,338,579 0.91% 876,473 314 310,070 -80,000 2.1 32 38% 1.25%
17 16 DR Congo 89,561,403 3.19% 2,770,836 40 2,267,050 23,861 6 17 46% 1.15%
18 17 Turkey 84,339,067 1.09% 909,452 110 769,630 283,922 2.1 32 76% 1.08%
19 18 Iran 83,992,949 1.30% 1,079,043 52 1,628,550 -55,000 2.2 32 76% 1.08%
20 19 Germany 83,783,942 0.32% 266,897 240 348,560 543,822 1.6 46 76% 1.07%
21 20 Thailand 69,799,978 0.25% 174,396 137 510,890 19,444 1.5 40 51% 0.90%
22 21 United Kingdom 67,886,011 0.53% 355,839 241,930 260,650 1.8 40 83% 0.87%
23 22 France 65,273,511 0.22% 143,783 119 547,557 36,527 1.9 42 82% 0.84%
24 23 Italy 60,461,826 -0.15% -88,249 206 294,140 148,943 1.3 47 69% 0.78%
25 24 Tanzania 59,734,218 2.98% 1,728,755 67 885,800 -40,076 4.9 18 37% 0.77%
26 25 South Africa 59,308,690 1.28% 750,420 49 1,213,090 145,405 2.4 28 67% 0.76%
27 26 Myanmar 54,409,800 0.67% 364,380 83 653,290 -163,313 2.2 29 31% 0.70%
28 27 Kenya 53,771,296 2.28% 1,197,323 94 569,140 -10,000 3.5 20 28% 0.69%
29 28 South Korea 51,269,185 0.09% 43,877 527 97,230 11,731 1.1 44 82% 0.66%
30 29 Colombia 50,882,891 1.08% 543,448 46 1,109,500 204,796 1.8 31 80% 0.65%
31 30 Spain 46,754,778 0.04% 18,002 94 498,800 40,000 1.3 45 80% 0.60%
32 31 Uganda 45,741,007 3.32% 1,471,413 229 199,810 168,694 5 17 26% 0.59%
33 32 Argentina 45,195,774 0.93% 415,097 17 2,736,690 4,800 2.3 32 93% 0.58%
34 33 Algeria 43,851,044 1.85% 797,990 18 2,381,740 -10,000 3.1 29 73% 0.56%
35 34 Sudan 43,849,260 2.42% 1,036,022 25 1,765,048 -50,000 4.4 20 35% 0.56%
36 35 Ukraine 43,733,762 -0.59% -259,876 75 579,320 10,000 1.4 41 69% 0.56%
37 36 Iraq 40,222,493 2.32% 912,710 93 434,320 7,834 3.7 21 73% 0.52%
38 37 Afghanistan 38,928,346 2.33% 886,592 60 652,860 -62,920 4.6 18 25% 0.50%
39 38 Poland 37,846,611 -0.11% -41,157 124 306,230 -29,395 1.4 42 60% 0.49%
40 39 Canada 37,742,154 0.89% 331,107 4 9,093,510 242,032 1.5 41 81% 0.48%
41 40 Morocco 36,910,560 1.20% 438,791 83 446,300 -51,419 2.4 30 64% 0.47%
42 41 Saudi Arabia 34,813,871 1.59% 545,343 16 2,149,690 134,979 2.3 32 84% 0.45%
43 42 Uzbekistan 33,469,203 1.48% 487,487 79 425,400 -8,863 2.4 28 50% 0.43%
44 43 Peru 32,971,854 1.42% 461,401 26 1,280,000 99,069 2.3 31 79% 0.42%
45 44 Angola 32,866,272 3.27% 1,040,977 26 1,246,700 6,413 5.6 17 67% 0.42%
46 45 Malaysia 32,365,999 1.30% 416,222 99 328,550 50,000 2 30 78% 0.42%
47 46 Mozambique 31,255,435 2.93% 889,399 786,380 -5,000 4.9 18 38% 0.40%
48 47 Ghana 31,072,940 2.15% 655,084 137 227,540 -10,000 3.9 22 57% 0.40%
49 48 Yemen 29,825,964 2.28% 664,042 56 527,970 -30,000 3.8 20 38% 0.38%
50 49 Nepal 29,136,808 1.85% 528,098 203 143,350 41,710 1.9 25 21% 0.37%
51 50 Venezuela 28,435,940 -0.28% -79,889 32 882,050 -653,249 2.3 30 N.A. 0.36%
52 51 Madagascar 27,691,018 2.68% 721,711 48 581,795 -1,500 4.1 20 39% 0.36%
53 52 Cameroon 26,545,863 2.59% 669,483 56 472,710 -4,800 4.6 19 56% 0.34%
54 53 Côte d'Ivoire 26,378,274 2.57% 661,730 83 318,000 -8,000 4.7 19 51% 0.34%
55 54 North Korea 25,778,816 0.44% 112,655 214 120,410 -5,403 1.9 35 63% 0.33%
56 55 Australia 25,499,884 1.18% 296,686 3 7,682,300 158,246 1.8 38 86% 0.33%
57 56 Niger 24,206,644 3.84% 895,929 19 1,266,700 4,000 7 15 17% 0.31%
58 57 Taiwan 23,816,775 0.18% 42,899 673 35,410 30,001 1.2 42 79% 0.31%
59 58 Sri Lanka 21,413,249 0.42% 89,516 341 62,710 -97,986 2.2 34 18% 0.27%
60 59 Burkina Faso 20,903,273 2.86% 581,895 76 273,600 -25,000 5.2 18 31% 0.27%
61 60 Mali 20,250,833 3.02% 592,802 17 1,220,190 -40,000 5.9 16 44% 0.26%
62 61 Romania 19,237,691 -0.66% -126,866 84 230,170 -73,999 1.6 43 55% 0.25%
63 62 Malawi 19,129,952 2.69% 501,205 203 94,280 -16,053 4.3 18 18% 0.25%
64 63 Chile 19,116,201 0.87% 164,163 26 743,532 111,708 1.7 35 85% 0.25%
65 64 Kazakhstan 18,776,707 1.21% 225,280 7 2,699,700 -18,000 2.8 31 58% 0.24%
66 65 Zambia 18,383,955 2.93% 522,925 25 743,390 -8,000 4.7 18 45% 0.24%
67 66 Guatemala 17,915,568 1.90% 334,096 167 107,160 -9,215 2.9 23 52% 0.23%
68 67 Ecuador 17,643,054 1.55% 269,392 71 248,360 36,400 2.4 28 63% 0.23%
69 68 Syria 17,500,658 2.52% 430,523 95 183,630 -427,391 2.8 26 60% 0.22%
70 69 Netherlands 17,134,872 0.22% 37,742 508 33,720 16,000 1.7 43 92% 0.22%
71 70 Senegal 16,743,927 2.75% 447,563 87 192,530 -20,000 4.7 19 49% 0.21%
72 71 Cambodia 16,718,965 1.41% 232,423 95 176,520 -30,000 2.5 26 24% 0.21%
73 72 Chad 16,425,864 3.00% 478,988 13 1,259,200 2,000 5.8 17 23% 0.21%
74 73 Somalia 15,893,222 2.92% 450,317 25 627,340 -40,000 6.1 17 47% 0.20%
75 74 Zimbabwe 14,862,924 1.48% 217,456 38 386,850 -116,858 3.6 19 38% 0.19%
76 75 Guinea 13,132,795 2.83% 361,549 53 245,720 -4,000 4.7 18 39% 0.17%
77 76 Rwanda 12,952,218 2.58% 325,268 525 24,670 -9,000 4.1 20 18% 0.17%
78 77 Benin 12,123,200 2.73% 322,049 108 112,760 -2,000 4.9 19 48% 0.16%
79 78 Burundi 11,890,784 3.12% 360,204 463 25,680 2,001 5.5 17 14% 0.15%
80 79 Tunisia 11,818,619 1.06% 123,900 76 155,360 -4,000 2.2 33 70% 0.15%
81 80 Bolivia 11,673,021 1.39% 159,921 11 1,083,300 -9,504 2.8 26 69% 0.15%
82 81 Belgium 11,589,623 0.44% 50,295 383 30,280 48,000 1.7 42 98% 0.15%
83 82 Haiti 11,402,528 1.24% 139,451 414 27,560 -35,000 3 24 57% 0.15%
84 83 Cuba 11,326,616 -0.06% -6,867 106 106,440 -14,400 1.6 42 78% 0.15%
85 84 South Sudan 11,193,725 1.19% 131,612 18 610,952 -174,200 4.7 19 25% 0.14%
86 85 Dominican Republic 10,847,910 1.01% 108,952 225 48,320 -30,000 2.4 28 85% 0.14%
87 86 Czech Republic (Czechia) 10,708,981 0.18% 19,772 139 77,240 22,011 1.6 43 74% 0.14%
88 87 Greece 10,423,054 -0.48% -50,401 128,900 -16,000 1.3 46 85% 0.13%
89 88 Jordan 10,203,134 1.00% 101,440 115 88,780 10,220 2.8 24 91% 0.13%
90 89 Portugal 10,196,709 -0.29% -29,478 111 91,590 -6,000 1.3 46 66% 0.13%
91 90 Azerbaijan 10,139,177 0.91% 91,459 123 82,658 1,200 2.1 32 56% 0.13%
92 91 Sweden 10,099,265 0.63% 62,886 25 410,340 40,000 1.9 41 88% 0.13%
93 92 Honduras 9,904,607 1.63% 158,490 89 111,890 -6,800 2.5 24 57% 0.13%
94 93 United Arab Emirates 9,890,402 1.23% 119,873 118 83,600 40,000 1.4 33 86% 0.13%
95 94 Hungary 9,660,351 -0.25% -24,328 107 90,530 6,000 1.5 43 72% 0.12%
96 95 Tajikistan 9,537,645 2.32% 216,627 68 139,960 -20,000 3.6 22 27% 0.12%
97 96 Belarus 9,449,323 -0.03% -3,088 47 202,910 8,730 1.7 40 79% 0.12%
98 97 Austria 9,006,398 0.57% 51,296 109 82,409 65,000 1.5 43 57% 0.12%
99 98 Papua New Guinea 8,947,024 1.95% 170,915 20 452,860 -800 3.6 22 13% 0.11%
100 99 Serbia 8,737,371 -0.40% -34,864 100 87,460 4,000 1.5 42 56% 0.11%
101 100 Israel 8,655,535 1.60% 136,158 400 21,640 10,000 3 30 93% 0.11%
102 101 Switzerland 8,654,622 0.74% 63,257 219 39,516 52,000 1.5 43 74% 0.11%
103 102 Togo 8,278,724 2.43% 196,358 152 54,390 -2,000 4.4 19 43% 0.11%
104 103 Sierra Leone 7,976,983 2.10% 163,768 111 72,180 -4,200 4.3 19 43% 0.10%
105 104 Hong Kong 7,496,981 0.82% 60,827 7,140 1,050 29,308 1.3 45 N.A. 0.10%
106 105 Laos 7,275,560 1.48% 106,105 32 230,800 -14,704 2.7 24 36% 0.09%
107 106 Paraguay 7,132,538 1.25% 87,902 18 397,300 -16,556 2.4 26 62% 0.09%
108 107 Bulgaria 6,948,445 -0.74% -51,674 64 108,560 -4,800 1.6 45 76% 0.09%
109 108 Libya 6,871,292 1.38% 93,840 4 1,759,540 -1,999 2.3 29 78% 0.09%
110 109 Lebanon 6,825,445 -0.44% -30,268 667 10,230 -30,012 2.1 30 78% 0.09%
111 110 Nicaragua 6,624,554 1.21% 79,052 55 120,340 -21,272 2.4 26 57% 0.08%
112 111 Kyrgyzstan 6,524,195 1.69% 108,345 34 191,800 -4,000 3 26 36% 0.08%
113 112 El Salvador 6,486,205 0.51% 32,652 313 20,720 -40,539 2.1 28 73% 0.08%
114 113 Turkmenistan 6,031,200 1.50% 89,111 13 469,930 -5,000 2.8 27 53% 0.08%
115 114 Singapore 5,850,342 0.79% 46,005 700 27,028 1.2 42 N.A. 0.08%
116 115 Denmark 5,792,202 0.35% 20,326 137 42,430 15,200 1.8 42 88% 0.07%
117 116 Finland 5,540,720 0.15% 8,564 18 303,890 14,000 1.5 43 86% 0.07%
118 117 Congo 5,518,087 2.56% 137,579 16 341,500 -4,000 4.5 19 70% 0.07%
119 118 Slovakia 5,459,642 0.05% 2,629 114 48,088 1,485 1.5 41 54% 0.07%
120 119 Norway 5,421,241 0.79% 42,384 15 365,268 28,000 1.7 40 83% 0.07%
121 120 Oman 5,106,626 2.65% 131,640 16 309,500 87,400 2.9 31 87% 0.07%
122 121 State of Palestine 5,101,414 2.41% 119,994 847 6,020 -10,563 3.7 21 80% 0.07%
123 122 Costa Rica 5,094,118 0.92% 46,557 100 51,060 4,200 1.8 33 80% 0.07%
124 123 Liberia 5,057,681 2.44% 120,307 53 96,320 -5,000 4.4 19 53% 0.06%
125 124 Ireland 4,937,786 1.13% 55,291 72 68,890 23,604 1.8 38 63% 0.06%
126 125 Central African Republic 4,829,767 1.78% 84,582 8 622,980 -40,000 4.8 18 43% 0.06%
127 126 New Zealand 4,822,233 0.82% 39,170 18 263,310 14,881 1.9 38 87% 0.06%
128 127 Mauritania 4,649,658 2.74% 123,962 5 1,030,700 5,000 4.6 20 57% 0.06%
129 128 Panama 4,314,767 1.61% 68,328 58 74,340 11,200 2.5 30 68% 0.06%
130 129 Kuwait 4,270,571 1.51% 63,488 240 17,820 39,520 2.1 37 N.A. 0.05%
131 130 Croatia 4,105,267 -0.61% -25,037 73 55,960 -8,001 1.4 44 58% 0.05%
132 131 Moldova 4,033,963 -0.23% -9,300 123 32,850 -1,387 1.3 38 43% 0.05%
133 132 Georgia 3,989,167 -0.19% -7,598 57 69,490 -10,000 2.1 38 58% 0.05%
134 133 Eritrea 3,546,421 1.41% 49,304 35 101,000 -39,858 4.1 19 63% 0.05%
135 134 Uruguay 3,473,730 0.35% 11,996 20 175,020 -3,000 2 36 96% 0.04%
136 135 Bosnia and Herzegovina 3,280,819 -0.61% -20,181 64 51,000 -21,585 1.3 43 52% 0.04%
137 136 Mongolia 3,278,290 1.65% 53,123 2 1,553,560 -852 2.9 28 67% 0.04%
138 137 Armenia 2,963,243 0.19% 5,512 104 28,470 -4,998 1.8 35 63% 0.04%
139 138 Jamaica 2,961,167 0.44% 12,888 273 10,830 -11,332 2 31 55% 0.04%
140 139 Qatar 2,881,053 1.73% 48,986 248 11,610 40,000 1.9 32 96% 0.04%
141 140 Albania 2,877,797 -0.11% -3,120 105 27,400 -14,000 1.6 36 63% 0.04%
142 141 Puerto Rico 2,860,853 -2.47% -72,555 323 8,870 -97,986 1.2 44 N.A. 0.04%
143 142 Lithuania 2,722,289 -1.35% -37,338 43 62,674 -32,780 1.7 45 71% 0.03%
144 143 Namibia 2,540,905 1.86% 46,375 3 823,290 -4,806 3.4 22 55% 0.03%
145 144 Gambia 2,416,668 2.94% 68,962 239 10,120 -3,087 5.3 18 59% 0.03%
146 145 Botswana 2,351,627 2.08% 47,930 4 566,730 3,000 2.9 24 73% 0.03%
147 146 Gabon 2,225,734 2.45% 53,155 9 257,670 3,260 4 23 87% 0.03%
148 147 Lesotho 2,142,249 0.80% 16,981 71 30,360 -10,047 3.2 24 31% 0.03%
149 148 North Macedonia 2,083,374 0.00% -85 83 25,220 -1,000 1.5 39 59% 0.03%
150 149 Slovenia 2,078,938 0.01% 284 103 20,140 2,000 1.6 45 55% 0.03%
151 150 Guinea-Bissau 1,968,001 2.45% 47,079 70 28,120 -1,399 4.5 19 45% 0.03%
152 151 Latvia 1,886,198 -1.08% -20,545 30 62,200 -14,837 1.7 44 69% 0.02%
153 152 Bahrain 1,701,575 3.68% 60,403 2,239 760 47,800 2 32 89% 0.02%
154 153 Equatorial Guinea 1,402,985 3.47% 46,999 50 28,050 16,000 4.6 22 73% 0.02%
155 154 Trinidad and Tobago 1,399,488 0.32% 4,515 273 5,130 -800 1.7 36 52% 0.02%
156 155 Estonia 1,326,535 0.07% 887 31 42,390 3,911 1.6 42 68% 0.02%
157 156 Timor-Leste 1,318,445 1.96% 25,326 89 14,870 -5,385 4.1 21 33% 0.02%
158 157 Mauritius 1,271,768 0.17% 2,100 626 2,030 0 1.4 37 41% 0.02%
159 158 Cyprus 1,207,359 0.73% 8,784 131 9,240 5,000 1.3 37 67% 0.02%
160 159 Eswatini 1,160,164 1.05% 12,034 67 17,200 -8,353 3 21 30% 0.01%
161 160 Djibouti 988,000 1.48% 14,440 43 23,180 900 2.8 27 79% 0.01%
162 161 Fiji 896,445 0.73% 6,492 49 18,270 -6,202 2.8 28 59% 0.01%
163 162 Réunion 895,312 0.72% 6,385 358 2,500 -1,256 2.3 36 100% 0.01%
164 163 Comoros 869,601 2.20% 18,715 467 1,861 -2,000 4.2 20 29% 0.01%
165 164 Guyana 786,552 0.48% 3,786 4 196,850 -6,000 2.5 27 27% 0.01%
166 165 Bhutan 771,608 1.12% 8,516 20 38,117 320 2 28 46% 0.01%
167 166 Solomon Islands 686,884 2.55% 17,061 25 27,990 -1,600 4.4 20 23% 0.01%
168 167 Macao 649,335 1.39% 8,890 21,645 30 5,000 1.2 39 N.A. 0.01%
169 168 Montenegro 628,066 0.01% 79 47 13,450 -480 1.8 39 68% 0.01%
170 169 Luxembourg 625,978 1.66% 10,249 242 2,590 9,741 1.5 40 88% 0.01%
171 170 Western Sahara 597,339 2.55% 14,876 2 266,000 5,582 2.4 28 87% 0.01%
172 171 Suriname 586,632 0.90% 5,260 4 156,000 -1,000 2.4 29 65% 0.01%
173 172 Cabo Verde 555,987 1.10% 6,052 138 4,030 -1,342 2.3 28 68% 0.01%
174 173 Micronesia 548,914 1.00% 5,428 784 700 -2,957 2.9 27 68% 0.01%
175 174 Maldives 540,544 1.81% 9,591 1,802 300 11,370 1.9 30 35% 0.01%
176 175 Malta 441,543 0.27% 1,171 1,380 320 900 1.5 43 93% 0.01%
177 176 Brunei 437,479 0.97% 4,194 83 5,270 0 1.8 32 80% 0.01%
178 177 Guadeloupe 400,124 0.02% 68 237 1,690 -1,440 2.2 44 N.A. 0.01%
179 178 Belize 397,628 1.86% 7,275 17 22,810 1,200 2.3 25 46% 0.01%
180 179 Bahamas 393,244 0.97% 3,762 39 10,010 1,000 1.8 32 86% 0.01%
181 180 Martinique 375,265 -0.08% -289 354 1,060 -960 1.9 47 92% 0.00%
182 181 Iceland 341,243 0.65% 2,212 3 100,250 380 1.8 37 94% 0.00%
183 182 Vanuatu 307,145 2.42% 7,263 25 12,190 120 3.8 21 24% 0.00%
184 183 French Guiana 298,682 2.70% 7,850 4 82,200 1,200 3.4 25 87% 0.00%
185 184 Barbados 287,375 0.12% 350 668 430 -79 1.6 40 31% 0.00%
186 185 New Caledonia 285,498 0.97% 2,748 16 18,280 502 2 34 72% 0.00%
187 186 French Polynesia 280,908 0.58% 1,621 77 3,660 -1,000 2 34 64% 0.00%
188 187 Mayotte 272,815 2.50% 6,665 728 375 0 3.7 20 46% 0.00%
189 188 Sao Tome & Principe 219,159 1.91% 4,103 228 960 -1,680 4.4 19 74% 0.00%
190 189 Samoa 198,414 0.67% 1,317 70 2,830 -2,803 3.9 22 18% 0.00%
191 190 Saint Lucia 183,627 0.46% 837 301 610 0 1.4 34 19% 0.00%
192 191 Channel Islands 173,863 0.93% 1,604 915 190 1,351 1.5 43 30% 0.00%
193 192 Guam 168,775 0.89% 1,481 313 540 -506 2.3 31 95% 0.00%
194 193 Curaçao 164,093 0.41% 669 444 515 1.8 42 89% 0.00%
195 194 Kiribati 119,449 1.57% 1,843 147 810 -800 3.6 23 57% 0.00%
196 195 Grenada 112,523 0.46% 520 331 340 -200 2.1 32 35% 0.00%
197 196 St. Vincent & Grenadines 110,940 0.32% 351 284 390 -200 1.9 33 53% 0.00%
198 197 Aruba 106,766 0.43% 452 593 180 201 1.9 41 44% 0.00%
199 198 Tonga 105,695 1.15% 1,201 147 720 -800 3.6 22 24% 0.00%
200 199 U.S. Virgin Islands 104,425 -0.15% -153 298 350 -451 2 43 96% 0.00%
201 200 Seychelles 98,347 0.62% 608 214 460 -200 2.5 34 56% 0.00%
202 201 Antigua and Barbuda 97,929 0.84% 811 223 440 0 2 34 26% 0.00%
203 202 Isle of Man 85,033 0.53% 449 149 570 N.A. N.A. 53% 0.00%
204 203 Andorra 77,265 0.16% 123 164 470 N.A. N.A. 88% 0.00%
205 204 Dominica 71,986 0.25% 178 96 750 N.A. N.A. 74% 0.00%
206 205 Cayman Islands 65,722 1.19% 774 274 240 N.A. N.A. 97% 0.00%
207 206 Bermuda 62,278 -0.36% -228 1,246 50 N.A. N.A. 97% 0.00%
208 207 Marshall Islands 59,190 0.68% 399 329 180 N.A. N.A. 70% 0.00%
209 208 Northern Mariana Islands 57,559 0.60% 343 125 460 N.A. N.A. 88% 0.00%
210 209 Greenland 56,770 0.17% 98 0 410,450 N.A. N.A. 87% 0.00%
211 210 American Samoa 55,191 -0.22% -121 276 200 N.A. N.A. 88% 0.00%
212 211 Saint Kitts & Nevis 53,199 0.71% 376 205 260 N.A. N.A. 33% 0.00%
213 212 Faeroe Islands 48,863 0.38% 185 35 1,396 N.A. N.A. 43% 0.00%
214 213 Sint Maarten 42,876 1.15% 488 1,261 34 N.A. N.A. 96% 0.00%
215 214 Monaco 39,242 0.71% 278 26,337 1 N.A. N.A. N.A. 0.00%
216 215 Turks and Caicos 38,717 1.38% 526 41 950 N.A. N.A. 89% 0.00%
217 216 Saint Martin 38,666 1.75% 664 730 53 N.A. N.A. 0% 0.00%
218 217 Liechtenstein 38,128 0.29% 109 238 160 N.A. N.A. 15% 0.00%
219 218 San Marino 33,931 0.21% 71 566 60 N.A. N.A. 97% 0.00%
220 219 Gibraltar 33,691 -0.03% -10 3,369 10 N.A. N.A. N.A. 0.00%
221 220 British Virgin Islands 30,231 0.67% 201 202 150 N.A. N.A. 52% 0.00%
222 221 Caribbean Netherlands 26,223 0.94% 244 80 328 N.A. N.A. 75% 0.00%
223 222 Palau 18,094 0.48% 86 39 460 N.A. N.A. N.A. 0.00%
224 223 Cook Islands 17,564 0.09% 16 73 240 N.A. N.A. 75% 0.00%
225 224 Anguilla 15,003 0.90% 134 167 90 N.A. N.A. N.A. 0.00%
226 225 Tuvalu 11,792 1.25% 146 393 30 N.A. N.A. 62% 0.00%
227 226 Wallis & Futuna 11,239 -1.69% -193 80 140 N.A. N.A. 0% 0.00%
228 227 Nauru 10,824 0.63% 68 541 20 N.A. N.A. N.A. 0.00%
229 228 Saint Barthelemy 9,877 0.30% 30 470 21 N.A. N.A. 0% 0.00%
230 229 Saint Helena 6,077 0.30% 18 16 390 N.A. N.A. 27% 0.00%
231 230 Saint Pierre & Miquelon 5,794 -0.48% -28 25 230 N.A. N.A. 100% 0.00%
232 231 Montserrat 4,992 0.06% 3 50 100 N.A. N.A. 10% 0.00%
233 232 Falkland Islands 3,480 3.05% 103 0 12,170 N.A. N.A. 66% 0.00%
234 233 Niue 1,626 0.68% 11 6 260 N.A. N.A. 46% 0.00%
235 234 Tokelau 1,357 1.27% 17 136 10 N.A. N.A. 0% 0.00%
236 235 Holy See 801 0.25% 2 2,003 0 N.A. N.A. N.A. 0.00%

906
notebooks/lec1.ipynb Normal file

File diff suppressed because one or more lines are too long

1322
notebooks/lec2 copy.ipynb Normal file

File diff suppressed because it is too large Load Diff

1357
notebooks/lec2.ipynb Normal file

File diff suppressed because it is too large Load Diff

3116
poetry.lock generated Normal file

File diff suppressed because it is too large Load Diff

2
poetry.toml Normal file
View File

@ -0,0 +1,2 @@
[virtualenvs]
in-project = true

24
pyproject.toml Normal file
View File

@ -0,0 +1,24 @@
[tool.poetry]
name = "mai"
version = "1.0.0"
description = "MAI Examples"
authors = ["Aleksey Filippov <al.filippov@ulstu.ru>"]
readme = "readme.md"
package-mode = false
[tool.poetry.dependencies]
python = "^3.12"
jupyter = "^1.1.1"
numpy = "^2.1.0"
pandas = "^2.2.2"
matplotlib = "^3.9.2"
flask = "^3.0.3"
apiflask = "^2.2.0"
flask-cors = "^5.0.0"
scikit-learn = "^1.5.2"
imbalanced-learn = "^0.12.3"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

0
readme.md Normal file
View File

16
run.py Normal file
View File

@ -0,0 +1,16 @@
from backend import create_app
app = create_app()
def __main():
app.run(
host="127.0.0.1",
port=8080,
debug=True,
use_reloader=False,
)
if __name__ == "__main__":
__main()