kind of big changes here: we can now inspect & see the most positive and negative words for a trained svm, to help tune the value C. then there is also the UI for setting value C in the SVM. Finally the value of C I adjusted to default to 0.01 (was 0.1 before) because the results and the weights look more sensible based on manual inspection. We need some dataset of people libraries in order to potentially cross-validate a good value C automatically. For now there are not enough active users of the site that such a thing could be attempted and succeed. Doing my best now just by eyeballing

This commit is contained in:
Andrej Karpathy
2021-12-08 00:17:37 -08:00
parent 6be574a0fe
commit 33b2b018ab
7 changed files with 99 additions and 40 deletions
-27
View File
@@ -13,31 +13,4 @@ const PaperLite = props => {
)
}
const Word = props => {
const p = props.word;
// word, weight, idf
return (
<div class='rel_word'>
<div class='rel_word_weight'>{p.weight.toFixed(2)}</div>
{/* <div class='rel_word_idf'>{p.idf.toFixed(2)}</div> */}
<div class="rel_word_txt">{p.word}</div>
</div>
)
}
const WordList = props => {
const lst = props.words;
const wlst = lst.map((jword, ix) => <Word key={ix} word={jword} />);
return (
<div>
<div>The following are the tokens and their (tfidf) weight in the paper vector. This is the actual summary that feeds into the SVM to power recommendations, so hopefully it is good and representative!</div>
<div id="wordList" class="rel_words">
{wlst}
</div>
</div>
)
}
ReactDOM.render(<PaperLite paper={paper} />, document.getElementById('wrap'))
ReactDOM.render(<WordList words={words} />, document.getElementById('wordwrap'))
+4
View File
@@ -80,12 +80,16 @@ const TagList = props => {
const tlst = lst.map((jtag, ix) => <Tag key={ix} tag={jtag} />);
const deleter = () => fetch("/del/" + prompt("delete tag name:"))
.then(response => console.log(response.text()));
// show the #wordwrap element if the user clicks inspect
const show_inspect = () => { document.getElementById("wordwrap").style.display = "block"; };
const inspect_elt = words.length > 0 ? <div id="inspect_svm" onClick={show_inspect}>inspect</div> : null;
return (
<div>
<div class="rel_tag" onClick={deleter}>-</div>
<div id="tagList" class="rel_utags">
{tlst}
</div>
{inspect_elt}
</div>
)
}
+22
View File
@@ -253,3 +253,25 @@ body {
margin: 10px 40px 0 40px;
font-size: 16px;
}
#tags_field {
width: 100px;
}
#pid_field {
width: 60px;
}
#time_filter_field {
width: 20px;
}
#svm_c_field {
width: 30px;
}
#tagList {
display: inline-block;
}
#inspect_svm {
display: inline-block;
font-size: 16px;
cursor: pointer;
text-decoration: underline;
color: #009;
}
+30
View File
@@ -0,0 +1,30 @@
'use strict';
const Word = props => {
const p = props.word;
// word, weight, idf
return (
<div class='rel_word'>
<div class='rel_word_weight'>{p.weight.toFixed(2)}</div>
{/* <div class='rel_word_idf'>{p.idf.toFixed(2)}</div> */}
<div class="rel_word_txt">{p.word}</div>
</div>
)
}
const WordList = props => {
const lst = props.words;
const words_desc = props.words_desc;
const wlst = lst.map((jword, ix) => <Word key={ix} word={jword} />);
return (
<div>
<div>{words_desc}</div>
<div id="wordList" class="rel_words">
{wlst}
</div>
</div>
)
}
ReactDOM.render(<WordList words={words} words_desc={words_desc} />,
document.getElementById('wordwrap'));