fix stuff
This commit is contained in:
parent
0545233f43
commit
8a24258a06
2594
src/machine_learning/data.txt
Normal file
2594
src/machine_learning/data.txt
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,10 @@
|
|||||||
|
import json
|
||||||
from typing import List
|
from typing import List
|
||||||
from itertools import product
|
from itertools import product
|
||||||
|
|
||||||
|
from const import main_path
|
||||||
|
|
||||||
|
|
||||||
visibility = ('bad', 'medium', 'good')
|
visibility = ('bad', 'medium', 'good')
|
||||||
stability = ('unstable', 'stable')
|
stability = ('unstable', 'stable')
|
||||||
ground = ('mud', 'grass', 'dry ground', 'concrete')
|
ground = ('mud', 'grass', 'dry ground', 'concrete')
|
||||||
@ -56,6 +60,19 @@ def generate_data_set() -> List[dict]:
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
data_set = generate_data_set()
|
def main():
|
||||||
training_set = data_set[:50] + data_set[55:90] + data_set[95:140] + data_set[145:200] + data_set[205:]
|
data_set = generate_data_set()
|
||||||
test_set = data_set[50:55] + data_set[90:95] + data_set[140:145]
|
with open('data.txt', 'w') as outfile:
|
||||||
|
json.dump(data_set, outfile)
|
||||||
|
|
||||||
|
|
||||||
|
with open(f'{main_path}/src/machine_learning/data.txt', 'r') as f:
|
||||||
|
data = f.read()
|
||||||
|
json_data = json.loads(data)
|
||||||
|
|
||||||
|
training_set = json_data[:50] + json_data[55:90] + json_data[95:140] + json_data[145:200] + json_data[205:]
|
||||||
|
test_set = json_data[50:55] + json_data[90:95] + json_data[140:145]
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user