[R] Suggest method

Boris Steipe boris.steipe at utoronto.ca
Thu Apr 23 08:00:24 CEST 2015


Please keep the conversation on the list ...

Here is a toy example to help you think this through:


set.seed(11235)

# artifical random data ...
# miles: normalized between 0 and 1
# flights: number of flights within last year
# since: how many days ago was the last flight booked
# score: just placeholder zeros for now
pList <- data.frame(miles=runif(100), 
                    flights=sample(0:12,100, replace=TRUE), 
                    since=sample(1:365, 100, replace=TRUE), 
                    score=0)
                    
# make up some weigthing scheme
fScore <- function(x) {
	m <- x[1]          # reward high number of miles
	f <- x[2]/3        # reward large number of flights
	s <- 10 / x[3]     # penalize if last flight was long ago
	return( m + f + s) # return score as sum of these factors
}

# calculate the scores and put the values into the data frame
pList$score <- apply(pList, MARGIN=1, FUN=fScore)

# Get the top three scoring passengers
pList[order(pList$score, decreasing=TRUE)[1:3], ]

        miles flights since    score
78 0.58376271       5     2 7.250429
94 0.01534421      12     7 5.443916
53 0.93216146      10    11 5.174586

# #78 flew very recently, #94 had lots of flights, #53 has lots of miles ...
# ... upgrade them to receive a free bag of peanuts each.


Note that the logic of selecting depends entirely on the way the score function is constructed. Clustering would not contribute anything useful.

That's as much as I'll write about this. This looks like a homework problem anyway and none of this is really an R problem.

B.  







On Apr 23, 2015, at 12:57 AM, Lalitha Kristipati <Lalitha.Kristipati at TechMahindra.com> wrote:

> Thanks for replying but how can i upgrade them from one level to another level. How to define a score?
> The attributes to  my use case are as follows:
> Customer name
> Distance travelled
> Status Credits
> Loyalty tier
> Usage characteristics
>  Based on the distance travelled, status credits, characteristics I need to cluster them. Then I can upgrade the passengers from one level to another level. But I don't know what method exactly need to follow .
> 
> -----Original Message-----
> From: Boris Steipe [mailto:boris.steipe at utoronto.ca] 
> Sent: Wednesday, April 22, 2015 9:08 PM
> To: Lalitha Kristipati
> Cc: R-help at r-project.org
> Subject: Re: [R] Suggest method
> 
> That does not sound like a clustering problem at all since you already know the desired characteristics and are not trying to discover structure in your data. Simply define a score as a suitably weighted sum of individual features, order your passengers by that score, and pick the top few, or any that exceed a threshold etc.
> 
> Not really an R problem at this point though.
> 
> 
> B.
> 
> On Apr 22, 2015, at 12:54 AM, Lalitha Kristipati <Lalitha.Kristipati at techmahindra.com> wrote:
> 
>> Hi,
>> 
>> I want to do a use case in R language. My problem statement is to upgrade the passengers from one membership level to another membership level in airlines based on their characteristics. It is like customer profiling based on their usage characteristics. Suggest a method that intakes a large amount of data and cluster them based on their characteristics and helps in knowing the passengers who are upgraded to another level .
>> Any help is appreciated.
>> 
>> Regards,
>> Lalitha Kristipati
>> Associate Software Engineer
>> 
>> 
>> 
>> ======================================================================
>> ======================================================
>> Disclaimer:  This message and the information contained herein is proprietary and confidential and subject to the Tech Mahindra policy statement, you may review the policy at http://www.techmahindra.com/Disclaimer.html externally http://tim.techmahindra.com/tim/disclaimer.html internally within TechMahindra.
>> ======================================================================
>> ======================================================
>> 
>> 
>> 	[[alternative HTML version deleted]]
>> 
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide 
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
> 
> 
> ============================================================================================================================
> Disclaimer:  This message and the information contained herein is proprietary and confidential and subject to the Tech Mahindra policy statement, you may review the policy at http://www.techmahindra.com/Disclaimer.html externally http://tim.techmahindra.com/tim/disclaimer.html internally within TechMahindra.
> ============================================================================================================================
> 



More information about the R-help mailing list