feat: Updated the research page as well
This commit is contained in:
parent
b40727c9df
commit
639e7e793b
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -3,6 +3,10 @@
|
||||||
# personal notes
|
# personal notes
|
||||||
Notes.md
|
Notes.md
|
||||||
|
|
||||||
|
# convenience old folder
|
||||||
|
pages/.old/*
|
||||||
|
pages/.old
|
||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
/node_modules
|
/node_modules
|
||||||
/.pnp
|
/.pnp
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
This repository creates a react webpage that allows to extract a utility function from possibly inconsistent binary comparisons
|
This repository creates a react webpage that allows to extract a utility function from possibly inconsistent binary comparisons
|
||||||
|
|
||||||
## Object structure
|
## Object structure
|
||||||
The core structure is json array of objects. Only the "name" attribute is required; the id is also internally required but it's created on the fly if it doesn't exist. The reason that ids are needed is that comparing objects is annoying.
|
The core structure is json array of objects. Only the "name" attribute is required; the (numerical) id is also internally required but it's created on the fly. The reason that ids are needed is that comparing objects is annoying.
|
||||||
|
|
||||||
The `isReferenceValue` property determines the display at the end, but it is optional.
|
The `isReferenceValue` property determines the display at the end, but it is optional.
|
||||||
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
[
|
|
||||||
{
|
|
||||||
"name": "Relative Impact of the First 10 EA Forum Prize Winners",
|
|
||||||
"url": "https://forum.effectivealtruism.org/posts/pqphZhx2nJocGCpwc/relative-impact-of-the-first-10-ea-forum-prize-winners",
|
|
||||||
"author": "Nuño Sempere",
|
|
||||||
"karma": 80
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Introducing Metaforecast: A Forecast Aggregator and Search Tool",
|
|
||||||
"url": "https://forum.effectivealtruism.org/posts/tEo5oXeSNcB3sYr8m/introducing-metaforecast-a-forecast-aggregator-and-search",
|
|
||||||
"author": "Nuño Sempere",
|
|
||||||
"karma": 115
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Forecasting Prize Results",
|
|
||||||
"url": "https://forum.effectivealtruism.org/posts/8QFWHzmur4roAcnCf/forecasting-prize-results",
|
|
||||||
"author": "Nuño Sempere",
|
|
||||||
"karma": 44,
|
|
||||||
"isReferenceValue": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "A Funnel for Cause Candidates",
|
|
||||||
"url": "https://forum.effectivealtruism.org/posts/iRA4Dd2bfX9nukSo3/a-funnel-for-cause-candidates",
|
|
||||||
"author": "Nuño Sempere",
|
|
||||||
"karma": 34
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "2020: Forecasting in Review",
|
|
||||||
"url": "https://forum.effectivealtruism.org/posts/8shCj2eoQygQvtoZP/2020-forecasting-in-review",
|
|
||||||
"author": "Nuño Sempere",
|
|
||||||
"karma": 35
|
|
||||||
}
|
|
||||||
]
|
|
|
@ -1,62 +0,0 @@
|
||||||
[
|
|
||||||
{
|
|
||||||
"name": "Relative Impact of the First 10 EA Forum Prize Winners",
|
|
||||||
"url": "https://forum.effectivealtruism.org/posts/pqphZhx2nJocGCpwc/relative-impact-of-the-first-10-ea-forum-prize-winners",
|
|
||||||
"author": "Nuño Sempere",
|
|
||||||
"karma": 80
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Introducing Metaforecast: A Forecast Aggregator and Search Tool",
|
|
||||||
"url": "https://forum.effectivealtruism.org/posts/tEo5oXeSNcB3sYr8m/introducing-metaforecast-a-forecast-aggregator-and-search",
|
|
||||||
"author": "Nuño Sempere",
|
|
||||||
"karma": 115
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Forecasting Prize Results",
|
|
||||||
"url": "https://forum.effectivealtruism.org/posts/8QFWHzmur4roAcnCf/forecasting-prize-results",
|
|
||||||
"author": "Nuño Sempere",
|
|
||||||
"karma": 44
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "A Funnel for Cause Candidates",
|
|
||||||
"url": "https://forum.effectivealtruism.org/posts/iRA4Dd2bfX9nukSo3/a-funnel-for-cause-candidates",
|
|
||||||
"author": "Nuño Sempere",
|
|
||||||
"karma": 34
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "2020: Forecasting in Review",
|
|
||||||
"url": "https://forum.effectivealtruism.org/posts/8shCj2eoQygQvtoZP/2020-forecasting-in-review",
|
|
||||||
"author": "Nuño Sempere",
|
|
||||||
"karma": 35
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Big List of Cause Candidates",
|
|
||||||
"url": "https://forum.effectivealtruism.org/posts/SCqRu6shoa8ySvRAa/big-list-of-cause-candidates",
|
|
||||||
"author": "Nuño Sempere",
|
|
||||||
"karma": 182
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "An experiment to evaluate the value of one researcher's work",
|
|
||||||
"url": "https://forum.effectivealtruism.org/posts/udGBF8YWshCKwRKTp/an-experiment-to-evaluate-the-value-of-one-researcher-s-work",
|
|
||||||
"author": "Nuño Sempere",
|
|
||||||
"karma": 55
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Predicting the Value of Small Altruistic Projects: A Proof of Concept Experiment",
|
|
||||||
"url": "https://forum.effectivealtruism.org/posts/qb56nicbnj9asSemx/predicting-the-value-of-small-altruistic-projects-a-proof-of",
|
|
||||||
"author": "Nuño Sempere",
|
|
||||||
"karma": 51
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Incentive Problems With Current Forecasting Competitions",
|
|
||||||
"url": "https://forum.effectivealtruism.org/posts/ztmBA8v6KvGChxw92/incentive-problems-with-current-forecasting-competitions",
|
|
||||||
"author": "Nuño Sempere",
|
|
||||||
"karma": 54
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Shapley Values: Better Than Counterfactuals",
|
|
||||||
"url": "https://forum.effectivealtruism.org/posts/XHZJ9i7QBtAJZ6byW/shapley-values-better-than-counterfactuals",
|
|
||||||
"author": "Nuño Sempere",
|
|
||||||
"karma": 92
|
|
||||||
}
|
|
||||||
]
|
|
|
@ -20,6 +20,7 @@ import { DisplayAsMarkdown } from '../lib/displayAsMarkdown'
|
||||||
import { CreateTableWithDistances } from '../lib/findPaths'
|
import { CreateTableWithDistances } from '../lib/findPaths'
|
||||||
import { TextAreaForJson } from "../lib/textAreaForJson"
|
import { TextAreaForJson } from "../lib/textAreaForJson"
|
||||||
import { pushToMongo } from "../lib/pushToMongo.js"
|
import { pushToMongo } from "../lib/pushToMongo.js"
|
||||||
|
import { toLocale, transformSliderValueToPracticalValue, transformSliderValueToActualValue, numToAlphabeticalString } from "../lib/utils.js"
|
||||||
|
|
||||||
/* Helpers */
|
/* Helpers */
|
||||||
let increasingList = (n) => Array.from(Array(n).keys())
|
let increasingList = (n) => Array.from(Array(n).keys())
|
||||||
|
@ -42,12 +43,7 @@ let checkIfListIsOrdered = (arr, binaryComparisons) => {
|
||||||
return isOrdered
|
return isOrdered
|
||||||
}
|
}
|
||||||
|
|
||||||
let transformSliderValueToActualValue = value => 10 ** value //>= 2 ? Math.round(10 ** value) : Math.round(10 * 10 ** value) / 10
|
let displayFunctionSliderInner = (value) => {
|
||||||
let toLocale = x => Number(x).toLocaleString()
|
|
||||||
let truncateValueForDisplay = value => value > 10 ? Number(Math.round(value)).toPrecision(2) : Math.round(value * 10) / 10
|
|
||||||
let transformSliderValueToPracticalValue = value => truncateValueForDisplay(transformSliderValueToActualValue(value))
|
|
||||||
|
|
||||||
let displayFunctionSlider = (value) => {
|
|
||||||
let result
|
let result
|
||||||
if (value >= 0) {
|
if (value >= 0) {
|
||||||
result = toLocale(transformSliderValueToPracticalValue(value))
|
result = toLocale(transformSliderValueToPracticalValue(value))
|
||||||
|
@ -59,6 +55,11 @@ let displayFunctionSlider = (value) => {
|
||||||
result = `1/${inverseresult}`
|
result = `1/${inverseresult}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
let displayFunctionSlider = (value) => {
|
||||||
|
let result = displayFunctionSliderInner(value)
|
||||||
result = `The first option is ${result}x as valuable as the second one`
|
result = `The first option is ${result}x as valuable as the second one`
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -92,7 +93,7 @@ export default function Home({ listOfElementsDefault }) {
|
||||||
|
|
||||||
//let initialComparePair = [list[list.length-2], list[list.length-1]]
|
//let initialComparePair = [list[list.length-2], list[list.length-1]]
|
||||||
let initialComparePair = [initialPosList[initialPosList.length - 2], initialPosList[initialPosList.length - 1]]
|
let initialComparePair = [initialPosList[initialPosList.length - 2], initialPosList[initialPosList.length - 1]]
|
||||||
let initialSliderValue = 0
|
let initialSliderValue = 1
|
||||||
let initialBinaryComparisons = []
|
let initialBinaryComparisons = []
|
||||||
let initialQuantitativeComparisons = []
|
let initialQuantitativeComparisons = []
|
||||||
let initialIsListOdered = false
|
let initialIsListOdered = false
|
||||||
|
@ -226,19 +227,19 @@ export default function Home({ listOfElementsDefault }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let nextStepSlider = ({ posList, binaryComparisons, sliderValue, element1, element2 }) => {
|
let nextStepSlider = ({ posList, binaryComparisons, sliderValue, element1, element2 }) => {
|
||||||
if (sliderValue < 0) {
|
if (sliderValue < 1 && sliderValue > 0) {
|
||||||
sliderValue = -sliderValue;
|
sliderValue = 1/sliderValue;
|
||||||
[element1, element2] = [element2, element1]
|
[element1, element2] = [element2, element1]
|
||||||
}
|
}
|
||||||
console.log(`posList@nextStepSlider:`)
|
console.log(`posList@nextStepSlider:`)
|
||||||
console.log(posList)
|
console.log(posList)
|
||||||
let successStatus = nextStepSimple(posList, binaryComparisons, element1, element2)
|
let successStatus = nextStepSimple(posList, binaryComparisons, element1, element2)
|
||||||
|
|
||||||
let newQuantitativeComparison = [element1, element2, transformSliderValueToPracticalValue(sliderValue)]
|
let newQuantitativeComparison = [element1, element2, transformSliderValueToActualValue(sliderValue)]
|
||||||
let newQuantitativeComparisons = [...quantitativeComparisons, newQuantitativeComparison]
|
let newQuantitativeComparisons = [...quantitativeComparisons, newQuantitativeComparison]
|
||||||
setQuantitativeComparisons(newQuantitativeComparisons)
|
setQuantitativeComparisons(newQuantitativeComparisons)
|
||||||
|
|
||||||
setSliderValue(0)
|
setSliderValue(1)
|
||||||
if (successStatus) {
|
if (successStatus) {
|
||||||
let jsObject = nicelyFormatLinks(quantitativeComparisons, listOfElements)
|
let jsObject = nicelyFormatLinks(quantitativeComparisons, listOfElements)
|
||||||
pushToMongo(jsObject)
|
pushToMongo(jsObject)
|
||||||
|
@ -272,6 +273,40 @@ export default function Home({ listOfElementsDefault }) {
|
||||||
</DisplayElement>
|
</DisplayElement>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="flex m-auto w-72">
|
||||||
|
<div className="block m-auto text-center">
|
||||||
|
{/*`is ${displayFunctionSliderInner(sliderValue)}x times as valuable as`*/}
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<label>
|
||||||
|
{`... is `}
|
||||||
|
<br />
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
value={sliderValue}
|
||||||
|
onChange={(event) =>{
|
||||||
|
//console.log(event)
|
||||||
|
//console.log(event.target.value)
|
||||||
|
setSliderValue(event.target.value)
|
||||||
|
}}
|
||||||
|
className="text-center"
|
||||||
|
/>
|
||||||
|
<br />
|
||||||
|
{`times as valuable as ...`}
|
||||||
|
</label>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
|
||||||
|
<SubmitSliderButton
|
||||||
|
posList={posList}
|
||||||
|
binaryComparisons={binaryComparisons}
|
||||||
|
sliderValue={sliderValue}
|
||||||
|
toComparePair={toComparePair}
|
||||||
|
nextStepSlider={nextStepSlider}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
className="flex m-auto border-gray-300 border-4 h-72 w-72 p-5 "
|
className="flex m-auto border-gray-300 border-4 h-72 w-72 p-5 "
|
||||||
//onClick={() => nextStep(binaryComparisons, toComparePair[1], toComparePair[0])}
|
//onClick={() => nextStep(binaryComparisons, toComparePair[1], toComparePair[0])}
|
||||||
|
@ -282,6 +317,10 @@ export default function Home({ listOfElementsDefault }) {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
</div>
|
||||||
|
{/*
|
||||||
|
|
||||||
<div className={`flex row-start-3 row-end-3 col-start-1 col-end-4 md:col-start-3 md:col-end-3 md:row-start-1 md:row-end-1 lg:col-start-3 lg:col-end-3 lg:row-start-1 lg:row-end-1 items-center justify-center mb-4 mt-10 ${isListOrdered ? "hidden" : ""}`}>
|
<div className={`flex row-start-3 row-end-3 col-start-1 col-end-4 md:col-start-3 md:col-end-3 md:row-start-1 md:row-end-1 lg:col-start-3 lg:col-end-3 lg:row-start-1 lg:row-end-1 items-center justify-center mb-4 mt-10 ${isListOrdered ? "hidden" : ""}`}>
|
||||||
<SliderElement
|
<SliderElement
|
||||||
className="flex items-center justify-center"
|
className="flex items-center justify-center"
|
||||||
|
@ -291,13 +330,8 @@ export default function Home({ listOfElementsDefault }) {
|
||||||
domain={domain}
|
domain={domain}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<SubmitSliderButton
|
*/}
|
||||||
posList={posList}
|
|
||||||
binaryComparisons={binaryComparisons}
|
|
||||||
sliderValue={sliderValue}
|
|
||||||
toComparePair={toComparePair}
|
|
||||||
nextStepSlider={nextStepSlider}
|
|
||||||
/>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user