File size: 2,253 Bytes
1d3a987
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import joblib
import pandas as pd

with open("scaler.joblib", 'rb') as f:
    scaler = joblib.load(f)

# data = {
#     "Pregnancies": [6],
#     "Glucose": [148]
#     "BloodPressure": [72],
#     "SkinThickness": [35]
#     "BMI": [33.6],
#     "DiabetesPedigreeFunction": [0.627]
#     "Age": [50]
# }

# df = pd.DataFrame(data)

outs = scaler.transform([[6, 148, 72, 35, 33.6, 0.627, 50]])
for i in outs[0]:
    print(i)

# def is_number(text):
#     try:
#         # Try to convert the text to a float
#         float(text)
#         return True
#     except ValueError:
#         # If conversion fails, it's not a number
#         return False

# inp = "1.5"    
# if is_number(inp):
#     print(int(inp.split('.')[0]))

# print(int(1.5))

# def diabetic_pedigree_function(mother, father, siblings):
#     """
#     Calculate a scaled Diabetic Pedigree Function (DPF) for an individual,
#     aiming for an output range of approximately (0.078, 2.42).

#     Parameters:
#     mother (int): 1 if the mother has diabetes, 0 otherwise.
#     father (int): 1 if the father has diabetes, 0 otherwise.
#     siblings (list): A list of 0s and 1s representing siblings' diabetes status.

#     Returns:
#     float: The scaled diabetic pedigree function score.
#     """
#     # Assign weights to each family member
#     mother_weight = 0.5
#     father_weight = 0.5
#     sibling_weight = 0.25
    
#     # Calculate the weighted contributions
#     family_history = (mother * mother_weight) + (father * father_weight) + (sum(siblings) * sibling_weight)
    
#     # Add a scaling factor to shift the range
#     scaling_factor = 1.2
#     bias = 0.078  # Minimum value in the desired range
    
#     # Final scaled DPF score
#     dpf_score = family_history * scaling_factor + bias
    
#     return round(dpf_score, 3)  # Rounded for clarity

# # Example usage:
# mother_history = 1  # Mother has diabetes
# father_history = 0  # Father doesn't have diabetes
# siblings_history = [1, 0, 0]  # One sibling has diabetes, two do not

# dpf = diabetic_pedigree_function(mother_history, father_history, siblings_history)
# print(f"The Diabetic Pedigree Function score is: {dpf}")