Skip to content

Instantly share code, notes, and snippets.

View jinglescode's full-sized avatar
🎯
stay focus

Hong Jing (Jingles) jinglescode

🎯
stay focus
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
async function trainModel(inputs, outputs, trainingsize, window_size, n_epochs, learning_rate, n_layers, callback){
const input_layer_shape = window_size;
const input_layer_neurons = 100;
const rnn_input_layer_features = 10;
const rnn_input_layer_timesteps = input_layer_neurons / rnn_input_layer_features;
const rnn_input_shape = [rnn_input_layer_features, rnn_input_layer_timesteps];
const rnn_output_neurons = 20;
function ComputeSMA(data, window_size)
{
let r_avgs = [], avg_prev = 0;
for (let i = 0; i <= data.length - window_size; i++){
let curr_avg = 0.00, t = i + window_size;
for (let k = i; k < t && k <= data.length; k++){
curr_avg += data[k]['price'] / window_size;
}
r_avgs.push({ set: data.slice(i, i + window_size), avg: curr_avg });
avg_prev = curr_avg;
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 4.
"Row #", "Label (Y)", "Features (X)"
1, 107.9674, "[127,135.25,138.25,149.19,158.13,157.5,155.13,84.75,82.75,82.37,81.81,87.81,93,89,92.12,92.12,89.62,85.75,89.44,85.56,84.81,86.25,85.75,94.69,104.44,107.25,113.19,117.94,113.81,109.94,105.87,104.25,110.62,105.25,96.62,104.25,105.37,113.06,104.12,96.87,105.06,106.37,105.87,109.31,110,113.62,128.06,127.37,134,137.81]"
2, 108.2624, "[135.25,138.25,149.19,158.13,157.5,155.13,84.75,82.75,82.37,81.81,87.81,93,89,92.12,92.12,89.62,85.75,89.44,85.56,84.81,86.25,85.75,94.69,104.44,107.25,113.19,117.94,113.81,109.94,105.87,104.25,110.62,105.25,96.62,104.25,105.37,113.06,104.12,96.87,105.06,106.37,105.87,109.31,110,113.62,128.06,127.37,134,137.81,141.75]"
3, 108.3312, "[138.25,149.19,158.13,157.5,155.13,84.75,82.75,82.37,81.81,87.81,93,89,92.12,92.12,89.62,85.75,89.44,85.56,84.81,86.25,85.75,94.69,104.44,107.25,113.19,117.94,113.81,109.94,105.87,104.25,110.62,105.25,96.62,104.25,105.37,113.06,104.12,96.87,105.06,106.37,105.87,109.31,110,113.62,128.06,127.37,134,137.81,1
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 18 columns, instead of 5. in line 5.
"",id,latitude,longitude,accommodates,bathrooms,bedrooms,beds,guests_included,minimum_nights,number_of_reviews,review_scores_rating,review_scores_accuracy,review_scores_cleanliness,review_scores_checkin,review_scores_communication,review_scores_location,review_scores_value
count,3.818000e+03,3818.000000,3818.000000,3818.000000,3802.000000,3812.000000,3817.000000,3818.000000,3818.000000,3818.000000,3171.000000,3160.000000,3165.000000,3160.000000,3167.000000,3163.000000,3162.000000
mean,5.550111e+06,47.628961,-122.333103,3.349398,1.259469,1.307712,1.735394,1.672603,2.369303,22.223415,94.539262,9.636392,9.556398,9.786709,9.809599,9.608916,9.452245
std,2.962660e+06,0.043052,0.031745,1.977599,0.590369,0.883395,1.139480,1.311040,16.305902,37.730892,6.606083,0.698031,0.797274,0.595499,0.568211,0.629053,0.750259
min,3.335000e+03,47.505088,-122.417219,1.000000,0.000000,0.000000,1.000000,0.000000,1.000000,0.000000,20.000000,2.000000,3.000000,2.000000,2.000000,4.000000,2.000000
25%,3.258256e+06,47.609418,-122.354320,2.0
id name neighbourhood_group_cleansed latitude longitude property_type room_type accommodates bathrooms bedrooms beds amenities price guests_included minimum_nights number_of_reviews review_scores_rating review_scores_accuracy review_scores_cleanliness review_scores_checkin review_scores_communication review_scores_location review_scores_value
241032 Stylish Queen Anne Apartment Queen Anne 47.63628904 -122.3710252 Apartment Entire home/apt 4 1 1 1 {TV,"Cable TV",Internet,"Wireless Internet","Air Conditioning",Kitchen,Heating,"Family/Kid Friendly",Washer,Dryer} $85.00 2 1 207 95 10 10 10 10 9 10
953595 Bright & Airy Queen Anne Apartment Queen Anne 47.63912312 -122.3656665 Apartment Entire home/apt 4 1 1 1 {TV,Internet,"Wireless Internet",Kitchen,"Free Parking on Premises","Buzzer/Wireless Intercom",Heating,"Family/Kid Friendly",Washer,Dryer,"Smoke Detector","Carbon Monoxide Detector","First Aid Kit","Safety Card","Fire Extinguisher",Essentials} $150.00 1 2 43 96 10 10 10 10 10 10
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 25 columns, instead of 15. in line 2.
,listing_id,name,neighbourhood_group_cleansed,latitude,longitude,property_type,room_type,accommodates,bathrooms,bedrooms,beds,amenities,price,guests_included,minimum_nights,number_of_reviews,review_scores_rating,review_scores_accuracy,review_scores_cleanliness,review_scores_checkin,review_scores_communication,review_scores_location,review_scores_value,estimated_revenue
0,241032,Stylish Queen Anne Apartment,Queen Anne,47.63628904,-122.3710252,Apartment,Entire home/apt,4,1,1,1,"{TV,""Cable TV"",Internet,""Wireless Internet"",""Air Conditioning"",Kitchen,Heating,""Family/Kid Friendly"",Washer,Dryer}",85,2,1,207,95,10,10,10,10,9,10,17595
1,953595,Bright & Airy Queen Anne Apartment,Queen Anne,47.63912312,-122.3656665,Apartment,Entire home/apt,4,1,1,1,"{TV,Internet,""Wireless Internet"",Kitchen,""Free Parking on Premises"",""Buzzer/Wireless Intercom"",Heating,""Family/Kid Friendly"",Washer,Dryer,""Smoke Detector"",""Carbon Monoxide Detector"",""First Aid Kit"",""Safety Card"",""Fire Extinguisher"",Essentials}",150,
listing_id number_of_reviews minimum_nights accommodates bedrooms beds estimated_revenued
2617 3594885 8 1000 4 1.0 1.0 1200000.0
2107 5056580 100 31 2 1.0 1.0 306900.0
1500 4009508 38 20 5 2.0 2.0 266000.0
1537 1954452 71 14 2 1.0 1.0 218680.0
1519 3971934 48 20 3 1.0 1.0 171840.0
listing_id number_of_reviews minimum_nights accommodates bedrooms beds estimated_revenued
1070 3385421 31 6 4 2.0 2.0 103602.0
2 3308979 20 4 11 5.0 7.0 78000.0
3667 53803 41 7 4 3.0 3.0 71750.0
1592 9460 240 3 2 1.0 1.0 71280.0
3165 3040278 156 2 4 2.0 2.0 67704.0
minimum_nights estimated_revenue
minimum_nights 1.0 0.8720842868140248
estimated_revenue 0.8720842868140248 1.0