Product Classification - classification

This is my first post on Stackoverflow but I've consulted this website very often. I was hoping someone could help me out.
I'm trying to do a mapping of a product catalogue (not sure if it's the right term) in order to simplify it in the end. What I would like to achieve is to get a overview of the current product structure.
Variables:
Product_Name: definition of the product, total of 27 unique products
Product_Type: either data, voice, add-on or non-services
Customer_segment: 6 distinct segments
Carrier_type: how is the product delivered? (fiber/coax etc.)
Optional variables:
Account_ID: customer number
Revenue
What am I trying to achieve?
I would like to see how the columns relate to each other. So if I have for example product A, then I would like to see which options are related to this particular product.
Product A
Segment A Segment B Segment C
Carrier A Carrier B Carrier A Carrier C Carrier B Carrier D
I'm looking for ways on how to make such decision trees in R since I do not want to make these on my own. Even more awesome would be to include the account ID and revenue somehow. I've already looked into Market Basket Analysis but this only gives me the most common combinations of products per account (basket). Now I want to see which products belong together and to see if there is any overlap between them in order to simplify it in the end.
I'm not asking for a complete set of code but more like a push into the right direction. Does anyone know which method of analysis would be suited to do this?
Thanks!

Related

DDD - Large aggregate and enforce invariant across aggregates

I'm kind of stuck at modeling this problem in the right way applying Domain Driven Design way. I want to model travelling group in a traveling agency.
We have concepts like passenger, group, and group member in one bounded context. This passenger is a large AR that holds all sorts of information, like name, job, address, bank account, religion, ANYTHING. But not all of them are necessary for all kinds of travels and their invariants differ based on the type of the trip. For example in travel type A, we don't need passengers' phone numbers. In travel type B we do. So when a person goes to create a group to go on travel type B, I will have an invariant on passenger AR to have a valid data for phone.
So basically there are two challenges here: How can I break this huge AR and how should I handle enforcing these conditional invariants? Is it OK if I enforce invariants on passenger AR inside handlers - application service- while creating group AR?
(Besides, the passenger AR and the group AR are in the same bounded context but they have the potential to be separated in the future).
I would say the constraint here should be not on passenger, but on the group.
At the end you may create passengers for different type of travels with or without phone numbers.
The actual constraint should be enforced like a passenger without a phone should not be added to that particular group as a group member.
Regarding the implementation side:
public void addPassengerToGroup(PassengerInformation passenger) {
//original code omitted
this.assertArgumentTrue(passenger.isPhoneInformationProvided(), "Passenger doesn't have contact information.");
this.groupMembers().add(passenger);
}
Somethink like this may solve your problem problem for constraint checks.
There is also some addition explanation for a similar situation:
https://softwareengineering.stackexchange.com/questions/319602/how-to-treat-validation-of-references-between-aggregates
This passenger is a large AR that holds all sorts of information, like name, job, address, bank account, religion, ANYTHING.
Well, to be honest, that sounds wrong as an aggregate. Consider why would you have this aggregate in the first place? What sort of business logic does this aggregate that involves the religion and bank account? or name? or address?
So, in short, this doesn't look like a Passenger aggregate. It looks more like a Customer record on a CRM without following DDD.
The first thing I would suggest is to consider your bounded contexts. I don't know your domain nor the specifics of your application, but most likely, you need bank account information for Finance reasons. So you'll have a Finance Bounded Context with Customers, their bank accounts, the invoices that you sent to them, and so on. You might also have a Bounded Context like Traveling or similar. Here, you might have a Passenger. A passenger could have a CustomerId and a TripId, plus other information, like ContactInformation and so on. You can also have Groups, with a list of Members and each Member could have a PassengerId and other information needed for the group management.
Obviously this is just an example from the limited information I have, but it seems to me, as I said, that a Customer becomes a Passenger when she signs up for a Trip. If the same Customer signs up for another trip, you'll create a new Passenger. There is no reason to reuse the same Passenger aggregate for multiple trips, because, as you said, even if it's the same person going to multiple Trips, the requirements for each are different, so trying to model a single Passenger that will fit all present and future types of Trips is creating an artificial coupling in my opinion.
Also, as I said previously, consider what information do you need on each aggregate. Even if across the whole application you know a lot of things from a single "person", it doesn't mean that you have to store them in a single place. That is the main point of DDD, in my opinion, finding where each piece of information belongs to and put it together with the business logic that needs it.

Creating custom daily evalutations in Moodle

I've been looking for a solution for kindergarten teachers to submit daily student evaluations (different criteria) in Moodle. So far, the closest solution that I've found is the Attendance plugin.
Does anyone know of a plugin that allows the teacher to submit a daily evaluation?
Another option that I'm looking into is Moodle Competency, which can actually fit the need, however, it looks like competency is not cumulative ... if I can find a way to make it cumulative that will be awesome.
For example, one of the competencies we have is "able to read sentences" and the scale is "1 - non-developed", "2- being developed" and "3- fully developed". At any point, the teacher or school admin would like to know how competent the student is. In our case, if this is an indicator that is being responded daily, we should be able to take the average and be able to evaluate the student.
The competency framework (to my understanding) doesn't calculate the average, rather it relies on being rated by the teacher.
Any thoughts where I should continue to look?
Attendance could be a great solution to your needs.
It could be hidden to the ones acting like students (I'm not shure if the kindergarden kids be interested in see this, maybe their parents)
Attendance have a full compatibility with course grading.
It could be configured to have diferent percentaje of final grading, so far, you can use one attendance activity for have a registry for their personal clairliness, another to record assessment in math, one more to social assessment and so on.
Finally all users with minimun acces as teacher (or another role you defined: example: school administration, scholar control) Could have facilities to export every grading to spreadsheet.
I've several years using it in a similar way you are asking to.
I hope this helps you.

Cinema Booking System Class Diagram Design

Hello all!
I have a question about where should the seats be assigned to keep track if it's booked for a showtime.
There is currently two way i thought of.
1) Assign the seats to the showtime instead of cinema. However this means that for each showtime it may have a different number of seats( which should not be true).
2) Check if the seat is assigned by accessing moviergoer->booking-> movieticket->seat number.
This method is tedious and uses more processing time. But i feel it's the right way as it will mean that the seats will be fixed.
I'm sorry if any other part of my diagram is wrongly drawn. However please guide me through this main question! I will be glad to get feedback for other part of my diagram too.
I really hope to learn more from this scenario.
Your design seems ok so far. Just a few observations:
you should remove the navigation in general since it does not add much value
the association from Booking to ShowTime seems superfluous as the Ticket already holds the needed information
re-think about duplicating cinema/movie:string in ShowTime as it adds unwanted redundancy
why do you have a <<use>> iso. an association in Review?
A seat is related to the cinema and the cinema offers show times. So 1) is ok.
Edit: You would map the ticket like this:
The both ID roles would map the ids in ShowTime and Seat. I would use an artificial integer for the seatID and likely some HHMM format for the showTimeID.

"Frenemies", or How to Make Teenagers Happy at a Birthday Party

I have a combinatorial optimization problem that I am struggling with. The technical details of the problem are cumbersome, so I have translated things in terms of a fictitious sweet-16 birthday party. Obviously, teenagers are NP difficult, but that's separate from the actual problem I'm trying to solve.
Let's say I have a son who is about to turn 16. He invites all of his friends for his birthday party, but not all of his friends like each other. In fact, every friend of my son's has at least one person they don't like, and some have more. These "frenemies" refuse to sit at the same table if one or more sworn "frenemy" is sitting at the same table. My son has provided me a list of all his invited friends, and also who doesn't like who. This information is symmetrical (If friend A doesn't like friend B, friend B doesn't like friend A), but it is NOT transitive (If friend A doesn't like friend B, but likes friend C, friend C is still free to like or dislike friend B). My question is: How do I determine the minimum number of tables that satisfies the condition that no two "frenemies" are seated at the same table?
This is a combinatorial optimization problem, not a machine learning problem.
Actually, it is a coloring problem: Create a graph G, where each vertex corresponds to a person. An edge (u, v) exists iff the two persons u and v do not like each other. You are now asking for the smallest k such that G is k-colorable. A coloring c(v) tells you which table person v is seated at.
Now you just have to pick an algorithm.
This sounds more like a constrained optimisation problem than a machine learning problem to me. I would model it as follows.
One variable per friend, the value would be the table,
additional constraints (as per list) of the form friendX !- friendY to say that these two can't sit at the same table.
That's the basic model that you can solve using a constraint solver of your choice (I recomment Minion). You can either minimise the highest table number (which would require some additional constraints), or simply try to find a solution with a given number of tables (i.e. values in the domains of the variables) until you get down to one where no solution exists.
Depending on the size of the problem (i.e. number of friends and tables) this may or may not work. Something you may have to consider is the symmetry in the problem (i.e. the people on table A can move to table B and vice versa and it's still a solution) which could be broken with additional constraints.

Help design a class diagram of a booking system

I got a request from my friend to write a php booking system module for his bowling club website, I am thinking to make this module as generic as possible, ie can also be used for booking pool tables etc.
So I started to draw up my UML class diagram:
I have 2 interfaces IBookingHandler(has implementation like BowlingBookingHandler) to handle different types of bookings and IPriceOption(has implementation like BowlingNormalPrice) to handle different types of prices. IBookingHandler uses IPriceOption to generate the total cost of the booking.
A data class "Booking" which represent a booking record in object
A ata parent data class "Type" and subclass "Lane" which has methods like etCurrentStock" to get instances of types for the booking.
Could anyone please review this design, and let me know what things are wrong or missing?
Much appreciated.
James Lin
You probably want a separate class for the customer. One customer could possibly have multiple bookings.
Is it wise to ha a implemenation for normal price? what's normal price? what if they want senior price during weekdays and disco bowling price during the evenening, and on new years eve they want another price. You don't want to release a new version everytime the price changes.
If you want to connect it to the bowling lane system ( there are plenty of them on the market) you probably want to have knowledge of all the players not just the one making the booking.
The more customer info you collect the better for your friend. Since he then have a cheap and easy way of advertising.