Różnice
Różnice między wybraną wersją a wersją aktualną.
|
|
pl:miw:miw08_rbs_ml:termostatleaf [2017/07/17 10:08] |
pl:miw:miw08_rbs_ml:termostatleaf [2019/06/27 15:50] (aktualna) |
| <code=java> |
| package MachineLearning; |
| |
| import java.util.*; |
| |
| /** |
| * Klasa reprezentująca liść drzewa decyzyjnego |
| * @author Angello |
| * |
| */ |
| public class TermostatLeaf |
| { |
| protected Integer m_category; |
| protected ArrayList<Integer> m_P; |
| |
| /** |
| * Konstruktor |
| * @param category |
| * @param P |
| */ |
| public TermostatLeaf(Integer category, ArrayList<Integer> P) |
| { |
| m_category = category; |
| this.p( P); |
| } |
| |
| public TermostatLeaf() |
| { |
| } |
| |
| /** |
| * Zwraca kategorię dla danego liścia |
| * @return Indeks kategorii |
| */ |
| public Integer category() |
| { |
| return m_category; |
| } |
| |
| /** |
| * Ustawia kategorię danego węzła |
| * @param category |
| */ |
| public void category(Integer category) |
| { |
| m_category = category; |
| } |
| |
| public ArrayList<Integer> p() |
| { |
| return m_P; |
| } |
| |
| public void p(ArrayList<Integer> p) |
| { |
| m_P = new ArrayList<Integer>( p); |
| } |
| |
| /** |
| * Zwraca kategorię |
| * @param attributes |
| * @return |
| */ |
| public Integer getCategory(Object[] attributes) |
| { |
| return m_category; |
| } |
| |
| /** |
| * Tworzy bardziej przejrzystą strukturę drzewa |
| * @return |
| */ |
| public ShowedNode showTree() |
| { |
| ShowedNode node = new ShowedNode(); |
| node.P = new Integer[m_P.size()]; |
| m_P.toArray(node.P); |
| node.Category = this.category(); |
| return node; |
| } |
| } |
| |
| </code> |