-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviewpredictor.html
More file actions
97 lines (83 loc) · 3.99 KB
/
Copy pathviewpredictor.html
File metadata and controls
97 lines (83 loc) · 3.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>YouTube Short View Prediction Calculator</title>
<style>
body {
font-family: Arial, sans-serif;
padding: 20px;
max-width: 600px;
margin: auto;
}
input {
margin: 5px 0;
width: 100%;
padding: 8px;
box-sizing: border-box;
}
label {
margin-top: 10px;
display: block;
}
button {
margin-top: 15px;
padding: 10px 20px;
font-size: 16px;
}
#result {
font-weight: bold;
}
</style>
</head>
<body>
<h1>YouTube Short View Prediction Calculator</h1>
<p>This is a view count approximator for YouTube shorts. Enter the information below to predict how many views your video will get.
Note that this calculator is not perfect, and there are always outliers that do not fit the model.
I will be updating the model with new information as time goes on to increase accuracy. </p>
<p>
Please consider subscribing to my channel to help support more open-source software like this! </p>
<script src="https://apis.google.com/js/platform.js"></script>
<center>
<div class="g-ytsubscribe" data-channelid="UCS9oAlDpRkq14yxmpmw2jpA" data-layout="default" data-count="default"></div>
<label for="field1">Enter your retention (average % viewed):</label>
<input type="number" id="field1" placeholder="e.g., 75.5" /><br/>
<label for="field2">Enter percentage of people who chose to view (did not swipe away):</label>
<input type="number" id="field2" placeholder="e.g., 85.2" /><br/>
<label for="field3">Enter video length (in seconds):</label>
<input type="number" id="field3" placeholder="e.g., 10" /><br/>
<button onclick="computeViews()">Estimate Views</button>
<p>Predicted views after initial algorithm recommendation spike: <span id="result"></span></p>
<script>
function computeViews() {
// Retrieve input values and parse them as floats
var percentageViewed = parseFloat(document.getElementById('field1').value);
var percentageChoseToView = parseFloat(document.getElementById('field2').value);
var videoLength = parseFloat(document.getElementById('field3').value);
// Check for valid inputs
if (isNaN(percentageViewed) || isNaN(percentageChoseToView) || isNaN(videoLength)) {
document.getElementById('result').innerText = "Please enter valid numbers in all fields.";
return;
}
// Calculate Log_Views using the provided formula
var logViews = -7.0629 + (0.0488 * percentageViewed) + (0.1816 * percentageChoseToView) + (0.0636 * videoLength);
// Calculate Views
var views = Math.exp(logViews) - 1;
// Handle potential negative or undefined results
if (views < 0 || isNaN(views) || !isFinite(views)) {
document.getElementById('result').innerText = "The calculation resulted in an invalid number of views. Please check your inputs.";
return;
}
// Format the result to an integer with commas
var viewsFormatted = Math.round(views).toLocaleString();
// Display the result
document.getElementById('result').innerText = viewsFormatted;
}
</script>
<p>If you have data of your own, please feel free to send it to me via Discord (discord.gg/CGhv6VnZpD) in .csv format. Include the following four columns:
Percentage_Video_Viewed, Percentage_Chose_to_View, Video_Length, Views</p>
<p>Here is the rough model produced from our regression-based predictor with current data: </p>
<img src="visualization2.png" alt="Regression Formula Visualization" style="max-width:100%; height:auto;">
</body>
</html>