O'qitish quvuri: hammasini bir joyga yig'ish
Retsept faqat bitta odamning boshida
Oshxonada bitta oshpaz bor va u ajoyib osh damlaydi. Hamma maqtaydi.
Lekin retsept yozilmagan. U oshpazning boshida. "Ko'z bilan solaman" deydi.
Bir kun oshpaz ta'tilga chiqdi. Mijozlar keldi, osh so'radi. Oshxonada hamma narsa bor — guruch, go'sht, sabzi, qozon. Lekin hech kim damlay olmaydi.
ML jamoalarida bu har kuni sodir bo'ladi. Model bor, u yaxshi ishlaydi. Lekin uni qayta
o'qitish uchun kerakli qadamlar kimningdir noutbukida, Untitled3.ipynb faylida, hujayralar
tartibsiz bajarilgan holda yotadi.
Model kerak bo'lganda qayta o'qitiladi — agar o'sha odam ishda bo'lsa.
Bitta buyruq
Yechim oddiy: retseptni yozib qo'yish. Shunchalik aniq yozish kerakki, boshqa odam uni o'qib, aynan o'sha oshni damlay olsin.
Dasturda bu quvur (pipeline) deyiladi: bitta buyruq, aniq bosqichlar, aniq natija.
Hozirgacha qismlar alohida ishladi. Endi ularni bitta buyruq bilan ishlaydigan quvurga birlashtiramiz.
Nima yig'iladi
Hozirgacha qismlar alohida ishladi. Endi ularni bitta buyruq bilan ishlaydigan quvurga birlashtiramiz:
diagramma( { "Ma'lumot\n(5-bob: hash)": (0, 2.0, 2.4, 1.0, "manba"), "Sifat darvozasi\n(6-bob)": (3.0, 2.0, 2.4, 1.0, "qayta"), "Xususiyat\n(3-bob)": (6.0, 2.0, 2.2, 1.0, "qayta"), "O'qitish\n(2-bob: seed)": (8.8, 2.0, 2.2, 1.0, "qayta"), "MLflow\n(22-bob)": (8.8, 0.2, 2.2, 1.0, "saqlash"), "Sifat sharti\nF1 >= chegara": (8.8, 3.8, 2.2, 1.0, "kuzatuv"), "Registr\n(23-bob)": (11.6, 2.0, 2.2, 1.0, "xizmat"), }, [ ("Ma'lumot\n(5-bob: hash)", "Sifat darvozasi\n(6-bob)"), ("Sifat darvozasi\n(6-bob)", "Xususiyat\n(3-bob)"), ("Xususiyat\n(3-bob)", "O'qitish\n(2-bob: seed)"), ("O'qitish\n(2-bob: seed)", "MLflow\n(22-bob)", "yozadi"), ("O'qitish\n(2-bob: seed)", "Sifat sharti\nF1 >= chegara"), ("Sifat sharti\nF1 >= chegara", "Registr\n(23-bob)", "o'tsa"), ], nom="oqitish_quvuri.png", kenglik=14, izoh="Har qism o'z bobidan keldi. Quvur ularni bog'laydi va SHARTLI ravishda registrga chiqaradi.", )

Har qism o'z bobidan keldi. Quvur ularni bog'laydi va SHARTLI ravishda registrga chiqaradi.
Eng muhim qism — sifat sharti. Model avtomatik registrga tushmaydi: avval chegaradan o'tishi kerak.
Quvur kodi
shu faylni yaratingsrc/oqitish/quvur.py
"""To'liq o'qitish quvuri: ma'lumotdan registrgacha. Har qadam oldingi boblardan keladi. Bu fayl faqat ularni BOG'LAYDI. """ import json from dataclasses import dataclass, field from pathlib import Path from typing import Any import mlflow import pandas as pd from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import train_test_split from sklearn.metrics import f1_score, precision_score, recall_score, roc_auc_score from quvur.kuzatuv import omborni_sozla, tajriba from quvur.manifest import fayl_hash from quvur.registr import alias_qoy, alias_versiyasi, royxatga_ol from quvur.sifat import darvoza, hisobot from quvur.sxema import IJARA_SXEMASI from quvur.takrorlanish import seedni_qulfla from quvur.xususiyat import XUSUSIYATLAR, tayyorla MODEL_NOMI = "broker-aniqlash" @dataclass(frozen=True, slots=True) class Talab: """Model registrga tushishi uchun qondirishi kerak bo'lgan shartlar.""" eng_kam_f1: float = 0.80 eng_kam_toliqlik: float = 0.75 eng_kam_toza_ulush: float = 0.95 @dataclass class Natija: holat: str # "chiqarildi" | "rad_etildi" | "toxtadi" metrikalar: dict[str, float] = field(default_factory=dict) versiya: int | None = None sabab: str = "" def oqit(malumot_yoli: str | Path, talab: Talab = Talab(), seed: int = 42, param: dict[str, Any] | None = None, chiqar: bool = True) -> Natija: """Quvurni boshdan-oxir bajaradi. Sifat shartlari bajarilmasa — chiqarmaydi.""" param = param or {"n_estimators": 150, "min_samples_leaf": 3} seedni_qulfla(seed) omborni_sozla() # 1) o'qish xom = pd.read_csv(malumot_yoli) # 2) sifat darvozasi (6-bob) — yomon ma'lumotda O'QITISH BOSHLANMAYDI h = hisobot(xom, IJARA_SXEMASI) ok, sabab = darvoza(h, talab.eng_kam_toza_ulush) if not ok: return Natija("toxtadi", sabab=f"ma'lumot sifati: {sabab}") toza = xom.iloc[:0].copy() if h["toza"] == 0 else None toza = pd.read_csv(malumot_yoli) if toza is None else toza # 3) xususiyat (3-bob) — o'qitish va xizmat uchun BITTA kod x = tayyorla(toza) y = toza["broker"] Xtr, Xte, ytr, yte = train_test_split(x, y, test_size=0.25, stratify=y, random_state=seed) # 4) o'qitish + kuzatuv (2-, 22-boblar) with tajriba(MODEL_NOMI, f"quvur-seed{seed}", teglar={"manba": "quvur"}): mlflow.log_params({**param, "seed": seed, "oqitish_qatorlari": len(Xtr)}) mlflow.set_tag("malumot_sha256", fayl_hash(malumot_yoli)[:16]) mlflow.log_metric("toza_ulush", h["toza_ulushi"]) m = RandomForestClassifier(**param, random_state=seed, n_jobs=1).fit(Xtr, ytr) p, e = m.predict(Xte), m.predict_proba(Xte)[:, 1] metrikalar = { "f1": float(f1_score(yte, p)), "aniqlik": float(precision_score(yte, p)), "toliqlik": float(recall_score(yte, p)), "auc": float(roc_auc_score(yte, e)), } mlflow.log_metrics(metrikalar) mlflow.sklearn.log_model(m, name="model", input_example=Xtr.head(3), skops_trusted_types=["sklearn.tree._tree.Tree"]) yugurish_id = mlflow.active_run().info.run_id # 5) sifat sharti — model YETARLICHA yaxshimi muammolar = [] if metrikalar["f1"] < talab.eng_kam_f1: muammolar.append(f"F1 {metrikalar['f1']:.4f} < {talab.eng_kam_f1}") if metrikalar["toliqlik"] < talab.eng_kam_toliqlik: muammolar.append(f"to'liqlik {metrikalar['toliqlik']:.4f} < {talab.eng_kam_toliqlik}") if muammolar: return Natija("rad_etildi", metrikalar, sabab="; ".join(muammolar)) if not chiqar: return Natija("rad_etildi", metrikalar, sabab="chiqar=False") # 6) registrga (23-bob) v = royxatga_ol(yugurish_id, MODEL_NOMI) alias_qoy(MODEL_NOMI, "staging", v) return Natija("chiqarildi", metrikalar, versiya=v) def chop_et(n: Natija) -> None: BELGI = {"chiqarildi": "+", "rad_etildi": "X", "toxtadi": "!"} print(f"[{BELGI[n.holat]}] holat: {n.holat}") if n.metrikalar: print(" " + " ".join(f"{k}={v:.4f}" for k, v in n.metrikalar.items())) if n.versiya: print(f" registr versiyasi: v{n.versiya} (staging)") if n.sabab: print(f" sabab: {n.sabab}")
Muvaffaqiyatli o'tish
python3 -c " import sys; sys.path.insert(0, 'src') from oqitish.quvur import Talab, chop_et, oqit chop_et(oqit('../datasets/ijara.csv', Talab())) "
[+] holat: chiqarildi
f1=0.8595 aniqlik=0.8929 toliqlik=0.8285 auc=0.9152
registr versiyasi: v1 (staging)
/home/abulqosim/.local/lib/python3.10/site-packages/requests/__init__.py:113: RequestsDependencyWarning: urllib3 (2.6.3) or chardet (6.0.0.post1)/charset_normalizer (3.4.4) doesn't match a supported version!
warnings.warn(
2026/09/29 18:59:34 INFO mlflow.agent.hint: Load the `instrumenting-with-mlflow-tracing` skill at /home/abulqosim/.local/lib/python3.10/site-packages/mlflow/assistant/skills/instrumenting-with-mlflow-tracing/SKILL.md before writing any tracing code; it ships with this MLflow install. Set MLFLOW_DISABLE_AGENT_HINT=1 to silence this.
2026/09/29 18:59:36 INFO mlflow.store.db.utils: Creating initial MLflow database tables...
2026/09/29 18:59:36 INFO mlflow.store.db.utils: Updating database tables
2026/09/29 18:59:40 INFO mlflow.tracking.fluent: Experiment with name 'broker-aniqlash' does not exist. Creating a new experiment.
/home/abulqosim/.local/lib/python3.10/site-packages/mlflow/types/utils.py:440: UserWarning: Hint: Inferred schema contains integer column(s). Integer columns in Python cannot represent missing values. If your input data contains missing values at inference time, it will be encoded as floats and will cause a schema enforcement error. The best way to avoid this problem is to infer the model schema based on a realistic data sample (training dataset) that includes missing values. Alternatively, you can declare integer columns as doubles (float64) whenever these columns may have missing values. See `Handling Integers With Missing Values <https://www.mlflow.org/docs/latest/models.html#handling-integers-with-missing-values>`_ for more details.
warnings.warn(
/home/abulqosim/.local/lib/python3.10/site-packages/mlflow/types/utils.py:440: UserWarning: Hint: Inferred schema contains integer column(s). Integer columns in Python cannot represent missing values. If your input data contains missing values at inference time, it will be encoded as floats and will cause a schema enforcement error. The best way to avoid this problem is to infer the model schema based on a realistic data sample (training dataset) that includes missing values. Alternatively, you can declare integer columns as doubles (float64) whenever these columns may have missing values. See `Handling Integers With Missing Values <https://www.mlflow.org/docs/latest/models.html#handling-integers-with-missing-values>`_ for more details.
warnings.warn(
2026/09/29 18:59:47 WARNING mlflow.utils.requirements_utils: Found torch version (2.9.1+cu128) contains a local version label (+cu128). MLflow logged a pip requirement for this package as 'torch==2.9.1' without the local version label to make it installable from PyPI. To specify pip requirements containing local version labels, please use `conda_env` or `pip_requirements`.
Successfully registered model 'broker-aniqlash'.
2026/09/29 18:59:48 WARNING mlflow.tracking._model_registry.fluent: Run with id 278b8fbe23e243789c48ec243fb7cb35 has no artifacts at artifact path 'model', registering model based on models:/m-4d1a9d62748b492d806a56486ec50e40 instead
Created version '1' of model 'broker-aniqlash'.
Bitta chaqiruv: ma'lumot tekshirildi, model o'qitildi, MLflow ga yozildi, sifat sharti bajarildi va
registrga staging sifatida chiqdi.
Sifat sharti ishlaydimi
Quvurda darvoza (quality gate) bor: model registrga chiqishi uchun F1 belgilangan chegaradan yuqori bo'lishi kerak.
Nega bu kerak? Chunki avtomatlashtirishning xavfli tomoni bor.
Quvurni yozdingiz, jadvalga qo'ydingiz — endi u har hafta o'zi ishlaydi va modelni yangilaydi. Ajoyib. Lekin bir hafta ma'lumot manbasi buzildi va model F1 0.4 bilan chiqdi.
Darvoza bo'lmasa, o'sha model avtomatik ravishda ishlab chiqarishga chiqadi. Hech kim ko'rmaydi, chunki jarayon avtomat.
Ya'ni siz mehnatni avtomatlashtirdingiz, lekin qarorni ham avtomatlashtirib qo'ydingiz. Qaror esa shart bilan himoyalangan bo'lishi kerak.
Darvoza ishlayotganini tekshirish uchun chegarani ataylab erishib bo'lmaydigan qilamiz:
python3 -c " import sys; sys.path.insert(0, 'src') from oqitish.quvur import Talab, chop_et, oqit chop_et(oqit('../datasets/ijara.csv', Talab(eng_kam_f1=0.95))) "
[X] holat: rad_etildi
f1=0.8595 aniqlik=0.8929 toliqlik=0.8285 auc=0.9152
sabab: F1 0.8595 < 0.95
/home/abulqosim/.local/lib/python3.10/site-packages/requests/__init__.py:113: RequestsDependencyWarning: urllib3 (2.6.3) or chardet (6.0.0.post1)/charset_normalizer (3.4.4) doesn't match a supported version!
warnings.warn(
2026/09/29 18:59:50 INFO mlflow.agent.hint: Load the `instrumenting-with-mlflow-tracing` skill at /home/abulqosim/.local/lib/python3.10/site-packages/mlflow/assistant/skills/instrumenting-with-mlflow-tracing/SKILL.md before writing any tracing code; it ships with this MLflow install. Set MLFLOW_DISABLE_AGENT_HINT=1 to silence this.
/home/abulqosim/.local/lib/python3.10/site-packages/mlflow/types/utils.py:440: UserWarning: Hint: Inferred schema contains integer column(s). Integer columns in Python cannot represent missing values. If your input data contains missing values at inference time, it will be encoded as floats and will cause a schema enforcement error. The best way to avoid this problem is to infer the model schema based on a realistic data sample (training dataset) that includes missing values. Alternatively, you can declare integer columns as doubles (float64) whenever these columns may have missing values. See `Handling Integers With Missing Values <https://www.mlflow.org/docs/latest/models.html#handling-integers-with-missing-values>`_ for more details.
warnings.warn(
/home/abulqosim/.local/lib/python3.10/site-packages/mlflow/types/utils.py:440: UserWarning: Hint: Inferred schema contains integer column(s). Integer columns in Python cannot represent missing values. If your input data contains missing values at inference time, it will be encoded as floats and will cause a schema enforcement error. The best way to avoid this problem is to infer the model schema based on a realistic data sample (training dataset) that includes missing values. Alternatively, you can declare integer columns as doubles (float64) whenever these columns may have missing values. See `Handling Integers With Missing Values <https://www.mlflow.org/docs/latest/models.html#handling-integers-with-missing-values>`_ for more details.
warnings.warn(
2026/09/29 18:59:59 WARNING mlflow.utils.requirements_utils: Found torch version (2.9.1+cu128) contains a local version label (+cu128). MLflow logged a pip requirement for this package as 'torch==2.9.1' without the local version label to make it installable from PyPI. To specify pip requirements containing local version labels, please use `conda_env` or `pip_requirements`.
Model o'qitildi va MLflow ga yozildi (tajriba yo'qolmadi), lekin registrga chiqmadi.
Bu muhim farq: yomon model ham qimmatli ma'lumot — u nima ishlamaganini ko'rsatadi. Lekin u foydalanuvchiga yetib bormaydi.
Yomon ma'lumotda quvur boshlanmaydi
python3 -c " import sys; sys.path.insert(0, 'src') import numpy as np, pandas as pd from oqitish.quvur import Talab, chop_et, oqit r = np.random.default_rng(3) d = pd.read_csv('../datasets/ijara.csv') d.loc[r.choice(len(d), 2000, replace=False), 'maydon'] = 0 # 17% buzuq d.to_csv('buzuq_malumot.csv', index=False) chop_et(oqit('buzuq_malumot.csv', Talab())) "
[!] holat: toxtadi
sabab: ma'lumot sifati: toza ulush 83.3% < talab 95%
/home/abulqosim/.local/lib/python3.10/site-packages/requests/__init__.py:113: RequestsDependencyWarning: urllib3 (2.6.3) or chardet (6.0.0.post1)/charset_normalizer (3.4.4) doesn't match a supported version!
warnings.warn(
2026/09/29 19:00:01 INFO mlflow.agent.hint: Load the `instrumenting-with-mlflow-tracing` skill at /home/abulqosim/.local/lib/python3.10/site-packages/mlflow/assistant/skills/instrumenting-with-mlflow-tracing/SKILL.md before writing any tracing code; it ships with this MLflow install. Set MLFLOW_DISABLE_AGENT_HINT=1 to silence this.
Holat toxtadi — o'qitish umuman boshlanmadi. Uch soatlik GPU vaqti tejaldi, chunki ma'lumot
sifati oldindan tekshirildi (11-bobdagi erta yiqilish qoidasi).
Uch xil natija
import pandas as pd show(pd.DataFrame([ {"holat": "toxtadi", "ma'nosi": "Ma'lumot sifati past — o'qitish boshlanmadi", "keyingi qadam": "Ma'lumot manbasini tekshiring (6-bob: karantin)"}, {"holat": "rad_etildi", "ma'nosi": "Model o'qitildi, lekin chegaradan o'tmadi", "keyingi qadam": "MLflow da taqqoslang, parametr yoki xususiyat o'zgartiring"}, {"holat": "chiqarildi", "ma'nosi": "Registrda staging sifatida turibdi", "keyingi qadam": "Sinovdan keyin production ga ko'chiring (23-bob)"}, ]))
| holat | ma'nosi | keyingi qadam |
|---|---|---|
| toxtadi | Ma'lumot sifati past — o'qitish boshlanmadi | Ma'lumot manbasini tekshiring (6-bob: karantin) |
| rad_etildi | Model o'qitildi, lekin chegaradan o'tmadi | MLflow da taqqoslang, parametr yoki xususiyat o'zgartiring |
| chiqarildi | Registrda staging sifatida turibdi | Sinovdan keyin production ga ko'chiring (23-bob) |
Diqqat: chiqarildi production degani emas. Quvur modelni faqat staging ga qo'yadi —
production ga ko'chirish odam qarori yoki alohida CI bosqichi (32-bob).
Takrorlanishni tekshiramiz
Quvur ikki marta ishga tushirilsa, bir xil natija berishi kerak (2-bob):
python3 -c " import sys; sys.path.insert(0, 'src') from oqitish.quvur import Talab, oqit a = oqit('../datasets/ijara.csv', Talab(), chiqar=False) b = oqit('../datasets/ijara.csv', Talab(), chiqar=False) print('1-yugurish F1:', round(a.metrikalar['f1'], 10)) print('2-yugurish F1:', round(b.metrikalar['f1'], 10)) print('bir xilmi :', a.metrikalar == b.metrikalar) "
1-yugurish F1: 0.8595041322 2-yugurish F1: 0.8595041322 bir xilmi : True /home/abulqosim/.local/lib/python3.10/site-packages/requests/__init__.py:113: RequestsDependencyWarning: urllib3 (2.6.3) or chardet (6.0.0.post1)/charset_normalizer (3.4.4) doesn't match a supported version! warnings.warn( 2026/09/29 19:00:04 INFO mlflow.agent.hint: Load the `instrumenting-with-mlflow-tracing` skill at /home/abulqosim/.local/lib/python3.10/site-packages/mlflow/assistant/skills/instrumenting-with-mlflow-tracing/SKILL.md before writing any tracing code; it ships with this MLflow install. Set MLFLOW_DISABLE_AGENT_HINT=1 to silence this. /home/abulqosim/.local/lib/python3.10/site-packages/mlflow/types/utils.py:440: UserWarning: Hint: Inferred schema contains integer column(s). Integer columns in Python cannot represent missing values. If your input data contains missing values at inference time, it will be encoded as floats and will cause a schema enforcement error. The best way to avoid this problem is to infer the model schema based on a realistic data sample (training dataset) that includes missing values. Alternatively, you can declare integer columns as doubles (float64) whenever these columns may have missing values. See `Handling Integers With Missing Values <https://www.mlflow.org/docs/latest/models.html#handling-integers-with-missing-values>`_ for more details. warnings.warn( /home/abulqosim/.local/lib/python3.10/site-packages/mlflow/types/utils.py:440: UserWarning: Hint: Inferred schema contains integer column(s). Integer columns in Python cannot represent missing values. If your input data contains missing values at inference time, it will be encoded as floats and will cause a schema enforcement error. The best way to avoid this problem is to infer the model schema based on a realistic data sample (training dataset) that includes missing values. Alternatively, you can declare integer columns as doubles (float64) whenever these columns may have missing values. See `Handling Integers With Missing Values <https://www.mlflow.org/docs/latest/models.html#handling-integers-with-missing-values>`_ for more details. warnings.warn( 2026/09/29 19:00:14 WARNING mlflow.utils.requirements_utils: Found torch version (2.9.1+cu128) contains a local version label (+cu128). MLflow logged a pip requirement for this package as 'torch==2.9.1' without the local version label to make it installable from PyPI. To specify pip requirements containing local version labels, please use `conda_env` or `pip_requirements`. /home/abulqosim/.local/lib/python3.10/site-packages/mlflow/types/utils.py:440: UserWarning: Hint: Inferred schema contains integer column(s). Integer columns in Python cannot represent missing values. If your input data contains missing values at inference time, it will be encoded as floats and will cause a schema enforcement error. The best way to avoid this problem is to infer the model schema based on a realistic data sample (training dataset) that includes missing values. Alternatively, you can declare integer columns as doubles (float64) whenever these columns may have missing values. See `Handling Integers With Missing Values <https://www.mlflow.org/docs/latest/models.html#handling-integers-with-missing-values>`_ for more details. warnings.warn( /home/abulqosim/.local/lib/python3.10/site-packages/mlflow/types/utils.py:440: UserWarning: Hint: Inferred schema contains integer column(s). Integer columns in Python cannot represent missing values. If your input data contains missing values at inference time, it will be encoded as floats and will cause a schema enforcement error. The best way to avoid this problem is to infer the model schema based on a realistic data sample (training dataset) that includes missing values. Alternatively, you can declare integer columns as doubles (float64) whenever these columns may have missing values. See `Handling Integers With Missing Values <https://www.mlflow.org/docs/latest/models.html#handling-integers-with-missing-values>`_ for more details. warnings.warn( 2026/09/29 19:00:21 WARNING mlflow.utils.requirements_utils: Found torch version (2.9.1+cu128) contains a local version label (+cu128). MLflow logged a pip requirement for this package as 'torch==2.9.1' without the local version label to make it installable from PyPI. To specify pip requirements containing local version labels, please use `conda_env` or `pip_requirements`.
chiqar=False — registrga tegmaydi, faqat o'qitadi. Sinov uchun qulay.
Seed o'zgarsa nima bo'ladi
python3 -c " import sys; sys.path.insert(0, 'src') from oqitish.quvur import Talab, oqit for seed in (42, 7, 2026): n = oqit('../datasets/ijara.csv', Talab(), seed=seed, chiqar=False) print(f' seed={seed:5} F1={n.metrikalar[\"f1\"]:.4f} to\'liqlik={n.metrikalar[\"toliqlik\"]:.4f}') "
seed= 42 F1=0.8595 to'liqlik=0.8285 seed= 7 F1=0.8659 to'liqlik=0.8379 seed= 2026 F1=0.8562 to'liqlik=0.8313 /home/abulqosim/.local/lib/python3.10/site-packages/requests/__init__.py:113: RequestsDependencyWarning: urllib3 (2.6.3) or chardet (6.0.0.post1)/charset_normalizer (3.4.4) doesn't match a supported version! warnings.warn( 2026/09/29 19:00:24 INFO mlflow.agent.hint: Load the `instrumenting-with-mlflow-tracing` skill at /home/abulqosim/.local/lib/python3.10/site-packages/mlflow/assistant/skills/instrumenting-with-mlflow-tracing/SKILL.md before writing any tracing code; it ships with this MLflow install. Set MLFLOW_DISABLE_AGENT_HINT=1 to silence this. /home/abulqosim/.local/lib/python3.10/site-packages/mlflow/types/utils.py:440: UserWarning: Hint: Inferred schema contains integer column(s). Integer columns in Python cannot represent missing values. If your input data contains missing values at inference time, it will be encoded as floats and will cause a schema enforcement error. The best way to avoid this problem is to infer the model schema based on a realistic data sample (training dataset) that includes missing values. Alternatively, you can declare integer columns as doubles (float64) whenever these columns may have missing values. See `Handling Integers With Missing Values <https://www.mlflow.org/docs/latest/models.html#handling-integers-with-missing-values>`_ for more details. warnings.warn( /home/abulqosim/.local/lib/python3.10/site-packages/mlflow/types/utils.py:440: UserWarning: Hint: Inferred schema contains integer column(s). Integer columns in Python cannot represent missing values. If your input data contains missing values at inference time, it will be encoded as floats and will cause a schema enforcement error. The best way to avoid this problem is to infer the model schema based on a realistic data sample (training dataset) that includes missing values. Alternatively, you can declare integer columns as doubles (float64) whenever these columns may have missing values. See `Handling Integers With Missing Values <https://www.mlflow.org/docs/latest/models.html#handling-integers-with-missing-values>`_ for more details. warnings.warn( 2026/09/29 19:00:33 WARNING mlflow.utils.requirements_utils: Found torch version (2.9.1+cu128) contains a local version label (+cu128). MLflow logged a pip requirement for this package as 'torch==2.9.1' without the local version label to make it installable from PyPI. To specify pip requirements containing local version labels, please use `conda_env` or `pip_requirements`. /home/abulqosim/.local/lib/python3.10/site-packages/mlflow/types/utils.py:440: UserWarning: Hint: Inferred schema contains integer column(s). Integer columns in Python cannot represent missing values. If your input data contains missing values at inference time, it will be encoded as floats and will cause a schema enforcement error. The best way to avoid this problem is to infer the model schema based on a realistic data sample (training dataset) that includes missing values. Alternatively, you can declare integer columns as doubles (float64) whenever these columns may have missing values. See `Handling Integers With Missing Values <https://www.mlflow.org/docs/latest/models.html#handling-integers-with-missing-values>`_ for more details. warnings.warn( /home/abulqosim/.local/lib/python3.10/site-packages/mlflow/types/utils.py:440: UserWarning: Hint: Inferred schema contains integer column(s). Integer columns in Python cannot represent missing values. If your input data contains missing values at inference time, it will be encoded as floats and will cause a schema enforcement error. The best way to avoid this problem is to infer the model schema based on a realistic data sample (training dataset) that includes missing values. Alternatively, you can declare integer columns as doubles (float64) whenever these columns may have missing values. See `Handling Integers With Missing Values <https://www.mlflow.org/docs/latest/models.html#handling-integers-with-missing-values>`_ for more details. warnings.warn( 2026/09/29 19:00:40 WARNING mlflow.utils.requirements_utils: Found torch version (2.9.1+cu128) contains a local version label (+cu128). MLflow logged a pip requirement for this package as 'torch==2.9.1' without the local version label to make it installable from PyPI. To specify pip requirements containing local version labels, please use `conda_env` or `pip_requirements`. /home/abulqosim/.local/lib/python3.10/site-packages/mlflow/types/utils.py:440: UserWarning: Hint: Inferred schema contains integer column(s). Integer columns in Python cannot represent missing values. If your input data contains missing values at inference time, it will be encoded as floats and will cause a schema enforcement error. The best way to avoid this problem is to infer the model schema based on a realistic data sample (training dataset) that includes missing values. Alternatively, you can declare integer columns as doubles (float64) whenever these columns may have missing values. See `Handling Integers With Missing Values <https://www.mlflow.org/docs/latest/models.html#handling-integers-with-missing-values>`_ for more details. warnings.warn( /home/abulqosim/.local/lib/python3.10/site-packages/mlflow/types/utils.py:440: UserWarning: Hint: Inferred schema contains integer column(s). Integer columns in Python cannot represent missing values. If your input data contains missing values at inference time, it will be encoded as floats and will cause a schema enforcement error. The best way to avoid this problem is to infer the model schema based on a realistic data sample (training dataset) that includes missing values. Alternatively, you can declare integer columns as doubles (float64) whenever these columns may have missing values. See `Handling Integers With Missing Values <https://www.mlflow.org/docs/latest/models.html#handling-integers-with-missing-values>`_ for more details. warnings.warn( 2026/09/29 19:00:47 WARNING mlflow.utils.requirements_utils: Found torch version (2.9.1+cu128) contains a local version label (+cu128). MLflow logged a pip requirement for this package as 'torch==2.9.1' without the local version label to make it installable from PyPI. To specify pip requirements containing local version labels, please use `conda_env` or `pip_requirements`.
Natija seedga qarab o'zgardi: 0.8562 dan 0.8659 gacha, ya'ni tarqalish 0.0097.
Bu son muhim. Ko'p maqolada "yangi usul F1 ni 0.005 ga oshirdi" deb yoziladi — bizning o'lchovimizda esa faqat seed o'zgargani uchun farq bundan ikki barobar katta chiqdi.
Bitta seed bilan qaror qabul qilmang
Ikki modelni taqqoslayotgan bo'lsangiz va farq 0.005 bo'lsa — bu shovqin bo'lishi mumkin. Yuqorida faqat seed o'zgargani uchun F1 0.0097 ga tebrandi, ya'ni o'sha "yaxshilanish"dan ikki barobar ko'p.
To'g'ri usul: bir necha seed bilan ishga tushirib, o'rtacha va tarqalishni solishtirish. Yoki cross-validation ishlatish. Aks holda siz shovqinni yaxshilanish deb qabul qilasiz.
Quvurni buyruq qatoridan ishlatish
shu faylni yaratingoqit_quvur.py
"""python3 oqit_quvur.py [malumot.csv] [--chiqarma]""" import sys sys.path.insert(0, "src") from oqitish.quvur import Talab, chop_et, oqit if __name__ == "__main__": args = [a for a in sys.argv[1:] if not a.startswith("--")] malumot = args[0] if args else "../datasets/ijara.csv" n = oqit(malumot, Talab(), chiqar="--chiqarma" not in sys.argv) chop_et(n) sys.exit({"chiqarildi": 0, "rad_etildi": 1, "toxtadi": 2}[n.holat])
python3 oqit_quvur.py ../datasets/ijara.csv --chiqarma echo "qaytish kodi: $?"
[X] holat: rad_etildi
f1=0.8595 aniqlik=0.8929 toliqlik=0.8285 auc=0.9152
sabab: chiqar=False
qaytish kodi: 1
/home/abulqosim/.local/lib/python3.10/site-packages/requests/__init__.py:113: RequestsDependencyWarning: urllib3 (2.6.3) or chardet (6.0.0.post1)/charset_normalizer (3.4.4) doesn't match a supported version!
warnings.warn(
2026/09/29 19:00:49 INFO mlflow.agent.hint: Load the `instrumenting-with-mlflow-tracing` skill at /home/abulqosim/.local/lib/python3.10/site-packages/mlflow/assistant/skills/instrumenting-with-mlflow-tracing/SKILL.md before writing any tracing code; it ships with this MLflow install. Set MLFLOW_DISABLE_AGENT_HINT=1 to silence this.
/home/abulqosim/.local/lib/python3.10/site-packages/mlflow/types/utils.py:440: UserWarning: Hint: Inferred schema contains integer column(s). Integer columns in Python cannot represent missing values. If your input data contains missing values at inference time, it will be encoded as floats and will cause a schema enforcement error. The best way to avoid this problem is to infer the model schema based on a realistic data sample (training dataset) that includes missing values. Alternatively, you can declare integer columns as doubles (float64) whenever these columns may have missing values. See `Handling Integers With Missing Values <https://www.mlflow.org/docs/latest/models.html#handling-integers-with-missing-values>`_ for more details.
warnings.warn(
/home/abulqosim/.local/lib/python3.10/site-packages/mlflow/types/utils.py:440: UserWarning: Hint: Inferred schema contains integer column(s). Integer columns in Python cannot represent missing values. If your input data contains missing values at inference time, it will be encoded as floats and will cause a schema enforcement error. The best way to avoid this problem is to infer the model schema based on a realistic data sample (training dataset) that includes missing values. Alternatively, you can declare integer columns as doubles (float64) whenever these columns may have missing values. See `Handling Integers With Missing Values <https://www.mlflow.org/docs/latest/models.html#handling-integers-with-missing-values>`_ for more details.
warnings.warn(
2026/09/29 19:00:58 WARNING mlflow.utils.requirements_utils: Found torch version (2.9.1+cu128) contains a local version label (+cu128). MLflow logged a pip requirement for this package as 'torch==2.9.1' without the local version label to make it installable from PyPI. To specify pip requirements containing local version labels, please use `conda_env` or `pip_requirements`.
Qaytish kodlari 15-bobdagi konvensiyaga mos: 0 muvaffaqiyat, 1 rad etildi, 2 boshlanmadi. CI aynan shu kodlarga qarab qaror qiladi (31-bob).
Xulosa
| Tushuncha | Asosiy fikr |
|---|---|
| Quvur bog'laydi | Har qism o'z bobidan; quvur faqat ularni ulaydi |
| Sifat darvozasi | Yomon ma'lumotda o'qitish boshlanmaydi |
| Sifat sharti | Model chegaradan o'tmasa registrga chiqmaydi |
| Yomon model ham yoziladi | MLflow da qoladi — nima ishlamagani ko'rinadi |
staging, production emas |
Avtomatik chiqarish faqat sinov muhitiga |
| Uch holat | toxtadi / rad_etildi / chiqarildi — har biriga o'z javobi |
| Seed tebranishi | Bitta yugurishga qarab xulosa chiqarmang |
| Qaytish kodlari | 0 / 1 / 2 — CI shularga qarab qaror qiladi |
Talaba ishi
Talabgaeng_kam_aucqo'shing. Qaysi shart birinchi buziladi — F1 mi, AUC mi?- Quvurni
ijara_yangi.csv(drift bor) da ishga tushiring. Qaysi holat qaytadi va nega? oqitgabir_necha_seed=[42, 7, 2026]parametrini qo'shing: o'rtacha F1 bo'yicha qaror qilsin. Bugotchadagi muammoni hal qiladimi?- Sifat shartini buzgan modelni ham
@rad_etilganaliasi bilan registrga qo'ying. Bu foydalimi yoki shovqinmi?
Bu bobni bepul o'qidingiz.
Kitob o'rgatadi, lekin sizning kodingiz nega ishlamaganini ayta olmaydi. Kursda uy vazifangiz tekshiriladi.