Posts

Showing posts from February 17, 2019

Solve the optimization problem of tree, should we make each rectangle contains exactly one training data...

Image
2 $begingroup$ I was reading Trevor Hastie and Robert Tibshirani's book "An Introduction to Statistical Learning with Applications in R". In page 306, when talking about the objective function of tree model, the book says: "The goal is to find boxes $R_1,...,R_J$ " that minimize the RSS, given by" $$sum_{j=1}^Jsum_{iin R_j}(y_i-hat{y}_{R_j})^2,$$ where $hat{y}_{R_j}$ is the mean response for the training observations within the $j$ th box. Unfortunately, it is computationally infeasible to consider every possible partition of the feature space into $J$ boxes." My question is: isn't the optimal solution to this RSS very obvious? We just partition the whole feature into $N$ rectangles such that each rectangle only contains one data point, then we achieve zero RSS. Let&

Ytre Arna

Image
Ytre Arna stad Ytre Arna Land   Noreg Fylke Hordaland Kommune Bergen Postnummer 5265 YTRE ARNA Wikimedia Commons: Ytre Arna Ytre Arna er ein tettbygd stad i Bergen kommune i Hordaland fylke. Staden ligg ved Sørfjorden, på austsida av Bergenshalvøya. Historie | Ytre Arna er eit gamalt industrisamfunn ved Sørfjorden. Arne fabrikker blei grunnlagd her av Peter Jebsen i 1846. I eldre tider vart staden kalla "Ælvæ" etter Blindheimselva som var godt synleg før fabrikken kom. Inntil 1972 høyrde Ytre Arna til Arna kommune og inntil 1964 til Haus kommune under Osterøy. Dette var naturleg i ei tid då fjordane med båttrafikk batt bygd og kyrkjesokn saman. Det gjekk ferje mellom Haus - Garnes - Votlo og Ytre Arna til slutten av 1970-talet. I dag er Arna ein del av Bergen kommune. Geografi | Ytre Arna strekkjer seg langs den vestlege delen av Arnavågen og vidare eit stykkje langs Sørfjorden ved Osterøy som går rundt Os

Concatenate words in such a way as to obtain the longest possible sub-string of the same letter

Image
3 $begingroup$ An array of N words is given. Each word consists of small letters ('a'- 'z'). Our goal is to concatenate the words in such a way as to obtain a single word with the longest possible sub-string composed of one particular letter. Find the length of such a sub-string. Examples: Given N=3 and words=['aabb','aaaa','bbab'], your function should return 6. One of the best concatenations is words[1]+words[0]+words[2]='aaaaaabbbbab'. The longest sub-string is composed of the letter 'a' and its length is 6. Given N=3 and words=['xxbxx','xbx','x'], your function should return 4. One of the best concatenations is words[0]+words[2]+words[1]='xxbxxxxbx'. The longest sub-string is composed of letter 'x