-
Notifications
You must be signed in to change notification settings - Fork 179
Expand file tree
/
Copy pathprediction.py
More file actions
42 lines (38 loc) · 1.66 KB
/
prediction.py
File metadata and controls
42 lines (38 loc) · 1.66 KB
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
# -*- coding: utf-8 -*-
#
# Copyright 2015-2025 BigML
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""class for the Tree Prediction object
This module defines an auxiliary Prediction object that is used in the
Tree module to store all the available prediction info.
"""
class Prediction():
"""A Prediction object containing the predicted Node info or the
subtree grouped prediction info for proportional missing strategy
"""
def __init__(self, output, path, confidence,
distribution=None, count=None, distribution_unit=None,
median=None, children=None, d_max=None, d_min=None):
self.output = output
self.path = path
self.confidence = confidence
self.distribution = [] if distribution is None else distribution
self.count = (sum([instances for _, instances in self.distribution])
if count is None else count)
self.distribution_unit = ('categorical' if distribution_unit is None
else distribution_unit)
self.median = median
self.children = [] if children is None else children
self.min = d_min
self.max = d_max