paint-brush
Ogaanshaha ka baxsan: Waxa aad u baahan tahay inaad ogaatoby@nataliaogneva
54,602 akhrin
54,602 akhrin

Ogaanshaha ka baxsan: Waxa aad u baahan tahay inaad ogaato

by Natalia Ogneva4m2024/04/23
Read on Terminal Reader
Read this story w/o Javascript

Aad u dheer; In la akhriyo

Falanqeeyayaasha inta badan waxay la kulmaan xog-bixiyeyaal inta ay ku jiraan shaqadooda. Go'aanadu waxay inta badan ku salaysan yihiin celceliska muunada, taas oo aad xasaasi u ah kuwa ka baxsan. Waa muhiim in la maareeyo kuwa ka baxsan si loo gaaro go'aanka saxda ah. Aynu tixgelinno dhowr habab oo fudud oo degdeg ah oo lagu shaqeynayo qiyamka aan caadiga ahayn.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Ogaanshaha ka baxsan: Waxa aad u baahan tahay inaad ogaato
Natalia Ogneva HackerNoon profile picture

Falanqeeyayaasha inta badan waxay la kulmaan xog-ururin ka baxsan inta ay ku jiraan shaqadooda, sida inta lagu jiro falanqaynta AB-tijaabada, abuurista moodallo saadaal ah, ama isbeddellada raadraaca. Go'aanadu waxay inta badan ku salaysan yihiin celceliska muunada, taas oo aad u xasaasi u ah kuwa ka baxsan oo si weyn u bedeli kara qiimaha. Marka, waa muhiim in la maareeyo kuwa ka baxsan si ay u gaaraan go'aanka saxda ah.


Aynu tixgelinno dhowr habab oo fudud oo degdeg ah oo lagu shaqeynayo qiyamka aan caadiga ahayn.

Samaynta dhibaatada

Bal qiyaas inaad u baahan tahay inaad samayso falanqayn tijaabo ah adoo isticmaalaya celceliska qiimaha dalabka sida mitirka aasaasiga ah. Aynu sheegno in mitirkeenu uu inta badan leeyahay qaybin caadi ah. Sidoo kale, waxaan ognahay in qaybinta mitirka ee kooxda imtixaanku ay ka duwan tahay kan kantaroolka. Si kale haddii loo dhigo, celceliska qaybinta xakamaynta waa 10, imtixaankuna waa 12. Isbeddelka caadiga ah ee labada kooxood waa 3.


Si kastaba ha ahaatee, labada muunadba waxay leeyihiin wax ka baxsan oo qalloociya macnaha muunadda iyo weecashada muunadda.

 import numpy as np N = 1000 mean_1 = 10 std_1 = 3 mean_2 = 12 std_2 = 3 x1 = np.concatenate((np.random.normal(mean_1, std_1, N), 10 * np.random.random_sample(50) + 20)) x2 = np.concatenate((np.random.normal(mean_2, std_2, N), 4 * np.random.random_sample(50) + 1))

NB in la tixgeliyo mitirku ay yeelan karaan kuwa ka baxsan labada dhinac. Haddii mitirkaagu uu lahaan karo wax ka baxsan hal dhinac, hababka si fudud ayaa loo beddeli karaa ujeedadaas.

Dabo Ka Jaro

Habka ugu fudud waa in la gooyo dhammaan indho-indheynta ka hor boqolkiiba 5% iyo ka dib 95% boqolkiiba . Xaaladdan oo kale, waxaan luminay 10% macluumaadka sida con. Si kastaba ha ahaatee, qaybintu waxay u egtahay mid la sameeyay, waqtiyada muunadduna waxay ku dhow yihiin waqtiyada qaybinta.

 import numpy as np x1_5pct = np.percentile(x1, 5) x1_95pct = np.percentile(x1, 95) x1_cutted = [i for i in x1 if i > x1_5pct and i < x1_95pct] x2_5pct = np.percentile(x2, 5) x2_95pct = np.percentile(x2, 95) x2_cutted = [i for i in x2 if i > x2_5pct and i < x2_95pct]


Si kale ayaa ah in laga saaro indho-indheynta ka baxsan xadka gaarka ah . Kooxda hoose waxay la mid tahay 25% boqolkiiba laga jaray kala badh kala badh dhexda ah, iyo kooxda sare waxay la mid tahay boqolkiiba 75 iyo badh. Halkan, waxaan lumin doonaa kaliya 0.7% macluumaadka. Qaybintu waxay u egtahay mid ka samaysan sidii hore. Daqiiqadaha muunadku waxay la siman yihiin waqtiyada qaybinta.

 import numpy as np low_band_1 = np.percentile(x1, 25) - 1.5 * np.std(x1) high_band_1 = np.percentile(x1, 75) + 1.5 * np.std(x1) x1_cutted = [i for i in x1 if i > low_band_1 and i < high_band_1] low_band_2 = np.percentile(x2, 25) - 1.5 * np.std(x2) high_band_2 = np.percentile(x2, 75) + 1.5 * np.std(x2) x2_cutted = [i for i in x2 if i > low_band_2 and i < high_band_2]

Bootstrap

Habka labaad ee aan halkan ku tixgelinay waa bootstrap. Habkan, celceliska waxa loo dhisay sida celceliska muunada hoose. Tusaalahayaga, celceliska kooxda xakamaynta waxay la mid tahay 10.35, kooxda imtixaankuna waa 11.78. Wali waa natiijo ka wanaagsan marka loo eego habaynta xogta dheeraadka ah.

 import pandas as pd def create_bootstrap_samples( sample_list: np.array, sample_size: int, n_samples: int ): # create a list for sample means sample_means = [] # loop n_samples times for i in range(n_samples): # create a bootstrap sample of sample_size with replacement bootstrap_sample = pd.Series(sample_list).sample(n = sample_size, replace = True) # calculate the bootstrap sample mean sample_mean = bootstrap_sample.mean() # add this sample mean to the sample means list sample_means.append(sample_mean) return pd.Series(sample_means) (create_bootstrap_samples(x1, len(x1), 1000).mean(), create_bootstrap_samples(x2, len(x2), 1000).mean())

Gabagabo

Ogaanshaha ka baxsan iyo habaynta ayaa muhiim u ah samaynta go'aanka saxda ah. Hadda, ugu yaraan saddex hab oo degdeg ah oo toosan ayaa kaa caawin kara inaad hubiso xogta ka hor falanqaynta.


Si kastaba ha ahaatee, waa lagama maarmaan in la xasuusto in kuwa la ogaaday ay noqon karaan qiyam aan caadi ahayn iyo sifo saameyn cusub leh. Laakiin waa sheeko kale :)