Association Classes of UML

Association Classes

  • Association classes allow you to add attributes, operations, and other features to associations, as shown in attached file (Association Classes.jpg). We can see from the diagram that a person may attend many meetings. We need to keep information about how awake that person was; we can do this by adding the attribute attentiveness to the association.
  • Attached file (Association Classes02.jpg) shows another way to represent this information: Make Attendance a full class in its own right. Note how the multiplicities have moved.
  • What benefit do you gain with the association class to offset the extra notation you have to remember? The association class adds an extra constraint, in that there can be only one instance of the association class between any two participating objects.
  • Implementing association classes isn't terribly obvious. My advice is to implement an association class as if it where a full class but to provide methods that get information to the classes linked by the association class. So for Figure 5.12 (Association Classes.jpg), I would see the following methods on Person:

class Person

List getAttendances(String meeting)

List getMeetings()

  • This way, a client of Person can get hold of the people at the meeting; if they want details, they can get the Attendances themselves. If you do this, remember to enforce the constraint that there can be only one Attendance object for any pair of Person and Meeting. You should place a check in whichever method creates the Attendance.

The information get from UML Distilled. 

 

Summary: association classes is likely make which as a full class, but to provide methods that get information to the classes linked by the association class. 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Certainly! Here's an example of fuzzy association rule mining using the Python library scikit-fuzzy: ```python import numpy as np import pandas as pd import skfuzzy as fuzz from sklearn.preprocessing import LabelEncoder # Load the dataset dataset = pd.read_csv('your_dataset.csv') # Preprocess the dataset label_encoder = LabelEncoder() dataset['Item'] = label_encoder.fit_transform(dataset['Item']) # Fuzzify the dataset fuzzy_dataset = fuzz.interp_membership(dataset['Item'], np.arange(len(dataset['Item'])), dataset['Support'], np.max) # Generate frequent itemsets frequent_itemsets = fuzz.frequent_itemsets(fuzzy_dataset, min_support=0.3, min_confidence=0.6) # Generate fuzzy association rules fuzzy_rules = fuzz.generate_association_rules(frequent_itemsets, min_confidence=0.6) # Print the fuzzy association rules for rule in fuzzy_rules: print(rule) ``` In this example, we assume that you have a dataset stored in a CSV file. The dataset contains two columns: 'Item' and 'Support'. 'Item' represents the items or products, and 'Support' represents their support values. First, we preprocess the dataset by encoding the categorical 'Item' column using LabelEncoder. Next, we fuzzify the dataset using `interp_membership` function, which assigns degrees of membership to each item based on their support values. Then, we generate frequent itemsets using the `frequent_itemsets` function. We specify the minimum support threshold (min_support) to determine which itemsets are frequent. Finally, we generate fuzzy association rules using the `generate_association_rules` function. We specify the minimum confidence threshold (min_confidence) to filter out weak rules. The generated fuzzy association rules are then printed out for further analysis. Please note that you need to adjust the parameters and adapt this code to your specific dataset and requirements. Also, ensure that you have the scikit-fuzzy library installed (`pip install scikit-fuzzy`) before running this code.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值