In [1]:
#-*- coding: utf8
from __future__ import division, print_function
from phoenix.models import WavePhoenixR
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
In [2]:
data = [520578, 429666, 397952, 505910, 405054, 256381, 649459, 535209, 524792, 462833, 565211, 687343, 636699, 603342, 813458, 832641, 924225, 970433, 1058284, 1789240, 1467022, 1361674, 1580239, 1585645, 1649960, 1581240, 1763891, 1505520, 1341269, 1544174, 1874544, 2031506, 2077288, 2214882, 2111487, 2087280, 2300856, 2672590, 3057718, 3212088, 3594824, 3607928, 3295138, 3589528, 3929102, 4219268, 4768364, 5018013, 5357443, 5019866, 5173064, 5444334, 5581247, 6202701, 7006687, 7032648, 6919060, 6719197, 6842544, 7212990, 7910952, 9664447, 9108651, 8820094, 9146978, 8418257, 8473949, 9550893, 11018902, 11736860, 10416584, 9738119, 9483200, 9321228, 8909267, 11481444, 12784802, 10849805, 9454005, 8803530, 8835570, 9069084, 11005339, 11615236, 9848207, 8449565, 8017559, 8126286, 8133914, 9467998, 10859777, 9832122, 7273529, 7614319, 7739443, 7633689, 9214745, 10957737, 9175074, 7587595, 7764514, 8484355, 8414463, 9836827, 11189149, 9377162, 7906863, 8065552, 8051642, 8601761, 9574078, 10454058, 8760752, 6828075, 6940728, 6758396, 7475981, 9105561, 11206549, 9367574, 7667185, 7120974, 7332373, 7178476, 8518937, 10511076, 8755494, 6932099, 7023241, 7389004, 7887420, 8565469, 11487589, 10209032, 7512689, 6682767, 6494478, 6549704, 7957156, 9311429, 7476852, 5808087, 5671298, 5951764, 6036078, 7156204, 8888429, 6897801, 5419944, 5476154, 5673707, 6040946, 7060284, 8138955, 6665434, 5369141, 8624024, 6962725, 8956125, 14924298, 11541865, 9492325, 9921559, 9019929, 7682540, 7052114, 7316434, 7819302, 7296451, 11085546, 7287532, 6389752, 5914194, 6215161, 7246611, 5928877, 5080581, 4849609, 5043994, 5336680, 5874136, 6878945, 5797948, 4385026, 4584479, 4541108, 4655647, 5267185, 6306349, 5376396, 4308772, 3681413, 4489439, 4271413, 5032795, 5953710, 5049273, 3962326, 4012856, 4048600, 4162806, 4786452, 5786704, 4960040, 3794802, 3764029, 3957399, 4014468, 4707340, 5617656, 4848504, 3889920, 3797241, 3733985, 3762549, 4454666, 5103411, 4363097, 3582828, 3470084, 3544961, 3638580, 4401248, 5426250, 4224641, 3164109, 3468998, 3306348, 3157505, 3746716, 5144933, 4329939, 3242996, 3108167, 3206673, 3408942, 3726897, 4575528, 3766935, 3022835, 3021680, 3015885, 3118800, 3735088, 4648755, 3934828, 2959366, 2901021, 2873277, 2889656, 3390074, 4060047, 3522396, 2772557, 2779615, 2880541, 2942589, 3232238, 3370352, 3114496, 2736286, 2486267, 2574656, 2719661, 2746360, 3346764, 2809162, 2240907, 2218082, 2329051, 2445492, 2926574, 3990257, 4220378, 3631999, 3322043, 2839298, 2688346, 3550368, 3893333, 2973921, 2137509, 2307979, 2349896, 2240535, 2501047, 2853962, 2509205, 2009597, 2143262, 2423911, 2316451, 2310104, 2656082, 2238667, 1823209, 1759979, 1847124, 1946184, 2144452, 2439730, 2003199, 1606718, 1598226, 1661170, 1667831, 1899119, 2238454, 2116519, 1752631, 1645825, 1642035, 1742668, 1989617, 2290706, 2013891, 1692240, 1625839, 1669896, 1740956, 1834506, 2139404, 1856432, 1614242, 1539186, 1503506, 1565075, 1729917, 1887569, 1660447, 1394235, 1444947, 1416540, 1390298, 1505303, 1669974, 1479979, 1287720, 1299237, 1276124, 1300069, 1381207, 1522580, 1305555, 1215816, 1235000, 1272230, 1374422, 1394487, 1529056, 1346645, 1260346, 1252824, 1255996, 1295045, 1403945, 1477193, 2191564, 1395833, 1372207, 2463147, 1341864, 1927184, 1650021, 2623358, 2947237, 1684224, 1189390, 1213568, 1326633, 1329957, 1171079, 1127822, 1124372, 1113470, 1100733, 1205090, 1270241, 1127974, 1094596, 1087548, 1053101, 1054306, 1214791, 1217006, 1090662, 1034406, 1039773, 1047610, 1068348, 1121260, 1174848, 1085700, 1033750, 1024127, 1062159, 1037714, 1082550, 1125624, 1042973, 1009021, 1076690, 1062314, 1069452, 1131626, 1201404, 1308454, 939452, 951912, 940037, 959168, 1080650, 1154721, 1055020, 919882, 880427, 905276, 896710, 998658, 1163679, 984427, 840402, 833984, 848721, 837183, 975047, 1205779, 1008897, 767616, 771686, 756693, 780916, 929299, 1073402, 912294, 709954, 705218, 705834, 718649, 850786, 1014891, 892357, 720660, 725652, 748325, 741509, 868118, 1066284, 905775, 719367, 735545, 803910, 803072, 943124, 1105894, 975401, 818138, 791833, 812249, 835844, 961647, 1109471, 935630, 768193, 793144, 818822, 829571, 962540, 1124023, 1005348, 844987, 839410, 785031, 873256, 1025542, 1168894, 1053445, 812220, 796252, 821785, 811054, 947204, 1111561, 1034968, 853981, 810984, 823659, 819858, 938461, 1152921, 969425, 763053, 772884, 799418, 820273, 971502, 1152222, 966040, 786763, 810022, 863079, 915460, 999834, 1155809, 970919, 792316, 801611, 854061, 860599, 969760, 1147332, 970812, 785217, 776486, 860520, 795485, 962033, 1146396, 959024, 767085, 766319, 800528, 854124, 935753, 1070980, 974719, 932175, 1135712, 1034452, 983544, 1062462, 1099100, 1042753, 1056354, 1687223, 1085504, 1021200, 1059459, 1114790, 1001356, 883433, 891419, 876013, 873431, 974177, 1136040, 970624, 792575, 806275, 845833, 821561, 940386, 1131729, 973537, 816732, 815515, 827487, 821041, 940088, 1095140, 959687, 779763, 804907, 833333, 841005, 912807, 1072332, 922285, 742791, 740753, 808256, 794750, 895617]
In [3]:
data = np.array(data, dtype='d')
In [4]:
plt.semilogy(data, 'g-')
plt.ylabel('Views')
plt.xlabel('Days after upload')
Out[4]:
In [5]:
model = WavePhoenixR(score_func='mdl', threshold=0.001).fit(data)
In [6]:
results = model(len(data))
In [7]:
plt.semilogy(data, 'g-')
plt.plot(results, 'r--')
plt.ylabel('Views')
plt.xlabel('Days after upload')
Out[7]:
In [8]:
model.parameters
Out[8]:
In [9]:
model = WavePhoenixR(score_func='msq', threshold=np.inf).fit(data)
results = model(len(data))
plt.semilogy(data, 'g-')
plt.plot(results, 'r--')
plt.ylabel('Views')
plt.xlabel('Days after upload')
Out[9]:
In [10]:
model.parameters
Out[10]:
In [ ]: