Datasets:
Update README.md
Browse files
README.md
CHANGED
@@ -71,6 +71,99 @@ In these files there are following fields:
|
|
71 |
|
72 |
# Dataset Simulation
|
73 |
|
74 |
-
For this dataset, the full source code is available for simulation by the Monte Carlo method.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
|
|
|
71 |
|
72 |
# Dataset Simulation
|
73 |
|
74 |
+
For this dataset, the full source code (C++) is available for simulation by the Monte Carlo method. We presented the file main.cpp only.
|
75 |
+
|
76 |
+
~~~
|
77 |
+
#include"simulation_for_machine_learning.h"
|
78 |
+
|
79 |
+
//Ñîçäàòü âñå êðèòåðèè
|
80 |
+
vector<HomogeneityTest*> AllTests()
|
81 |
+
{
|
82 |
+
vector<HomogeneityTest*> D;
|
83 |
+
|
84 |
+
// ---- Classical Two-Sample tests for Uncensored Case ----
|
85 |
+
//D.push_back( new HT_AndersonDarlingPetitt );
|
86 |
+
//D.push_back( new HT_KolmogorovSmirnovTest );
|
87 |
+
//D.push_back( new HT_LehmannRosenblatt );
|
88 |
+
|
89 |
+
// ---- Two-Sample tests for Right-Censored Case ----
|
90 |
+
D.push_back( new HT_Peto );
|
91 |
+
D.push_back( new HT_Gehan );
|
92 |
+
D.push_back( new HT_Logrank );
|
93 |
+
|
94 |
+
D.push_back( new HT_BagdonaviciusNikulinGeneralizedCox );
|
95 |
+
D.push_back( new HT_BagdonaviciusNikulinMultiple );
|
96 |
+
D.push_back( new HT_BagdonaviciusNikulinSingle );
|
97 |
+
|
98 |
+
D.push_back( new HT_QTest ); //based on the Kaplan-Meier estimator
|
99 |
+
D.push_back( new HT_MAX ); //Maximum Value test
|
100 |
+
D.push_back( new HT_SynthesisTest ); //MIN3 test
|
101 |
+
|
102 |
+
D.push_back( new HT_WeightedLogrank("logrank") );
|
103 |
+
D.push_back( new HT_WeightedLogrank("Tarone–Ware") );
|
104 |
+
D.push_back( new HT_WeightedLogrank("Breslow") );
|
105 |
+
D.push_back( new HT_WeightedLogrank("Peto–Prentice") );
|
106 |
+
D.push_back( new HT_WeightedLogrank("Prentice") );
|
107 |
+
|
108 |
+
D.push_back( new HT_WeightedKaplanMeyer );
|
109 |
+
|
110 |
+
return D;
|
111 |
+
}
|
112 |
+
|
113 |
+
// Example of two-sample testing using this code
|
114 |
+
void EXAMPLE_1(vector<HomogeneityTest*> &D)
|
115 |
+
{
|
116 |
+
// load the samples
|
117 |
+
Sample T1(".//samples//1Chemotherapy.txt");
|
118 |
+
Sample T2(".//samples//2Radiotherapy.txt");
|
119 |
+
|
120 |
+
// two-sample testing through selected tests
|
121 |
+
for(int j=0; j<D.size(); j++)
|
122 |
+
{
|
123 |
+
char test_name[512];
|
124 |
+
D[j]->TitleTest(test_name);
|
125 |
+
|
126 |
+
|
127 |
+
double Sn = D[j]->CalculateStatistic(T1, T2);
|
128 |
+
double pvalue = D[j]->p_value(T1, T2, 1000);
|
129 |
+
|
130 |
+
printf("%s\n", &test_name);
|
131 |
+
printf("\t Sn: %lf\n", Sn);
|
132 |
+
printf("\t pv: %lf\n", pvalue);
|
133 |
+
printf("--------------------------------");
|
134 |
+
}
|
135 |
+
}
|
136 |
+
|
137 |
+
// Example of the dataset simulation for the proposed ML-method
|
138 |
+
void EXAMPLE_2(vector<HomogeneityTest*> &D)
|
139 |
+
{
|
140 |
+
// Run dataset (train or test sample) simulation (results in ".//to_machine_learning_2024//")
|
141 |
+
simulation_for_machine_learning sm(D);
|
142 |
+
}
|
143 |
+
|
144 |
+
// init point
|
145 |
+
int main()
|
146 |
+
{
|
147 |
+
// Set the number of threads
|
148 |
+
int k = omp_get_max_threads() - 1;
|
149 |
+
//int k = 1;
|
150 |
+
omp_set_num_threads( k );
|
151 |
+
|
152 |
+
// Select two-sample tests
|
153 |
+
auto D = AllTests();
|
154 |
+
|
155 |
+
// Example of two-sample testing using this code
|
156 |
+
EXAMPLE_1(D);
|
157 |
+
|
158 |
+
// Example of the dataset simulation for the proposed ML-method
|
159 |
+
EXAMPLE_2(D);
|
160 |
+
|
161 |
+
// Freeing memory
|
162 |
+
ClearMemory(D);
|
163 |
+
|
164 |
+
printf("The mission is completed.\n");
|
165 |
+
return 0;
|
166 |
+
}
|
167 |
+
~~~
|
168 |
|
169 |
|