function renderUpdatesRatio(data) {
    var ratios = data["updateRatios"];

    var iter = data["scoresIter"];

    var chart = $("#updateRatioChart");

    if (chart.length) {

        var keys = Object.keys(ratios);
        var toPlot = [];
        var overallMax = -Number.MAX_VALUE;
        var overallMin = Number.MAX_VALUE;
        for (var i = 0; i < keys.length; i++) {
            var r = ratios[keys[i]];

            var pairs = [];
            for (var j = 0; j < r.length; j++) {
                pairs.push([iter[j], Math.log10(r[j])]);
            }
            toPlot.push({data: pairs, label: keys[i]});


            var thisMax = Math.max.apply(Math, r);
            var thisMin = Math.min.apply(Math, r);
            overallMax = Math.max(overallMax, thisMax);
            overallMin = Math.min(overallMin, thisMin);
        }

        if (overallMax == -Number.MAX_VALUE) overallMax = 1.0;
        if (overallMin == Number.MAX_VALUE) overallMin = 0.0;

        overallMax = Math.log10(overallMax);
        overallMin = Math.log10(overallMin);
        overallMin = Math.max(overallMin, -10);

        overallMax = Math.ceil(overallMax);
        overallMin = Math.floor(overallMin);

        var plot = $.plot(chart,
            toPlot, {
                series: {
                    lines: {
                        show: true,
                        lineWidth: 2
                    }
                    // points: {show: true},
                    // shadowSize: 2
                },
                grid: {
                    hoverable: true,
                    clickable: true,
                    tickColor: "#dddddd",
                    borderWidth: 0
                },
                yaxis: {min: overallMin, max: overallMax},
                colors: ["#FA5833", "#2FABE9"]
            });


        function showTooltip(x, y, contents) {
            $('<div id="tooltipRatioChart">' + contents + '</div>').css({
                position: 'absolute',
                display: 'none',
                top: y + 8,
                left: x + 10,
                border: '1px solid #fdd',
                padding: '2px',
                'background-color': '#dfeffc',
                opacity: 0.80
            }).appendTo("#updateRatioChart").fadeIn(200);
        }

        var previousPoint = null;
        chart.bind("plothover", function (event, pos, item) {
            if (typeof pos.x == 'undefined') return;

            var xPos = pos.x.toFixed(0);
            $("#xRatio").text(xPos < 0 || xPos == "-0" ? "" : xPos);
            $("#yLogRatio").text(pos.y.toFixed(5));
            $("#yRatio").text(Math.pow(10, pos.y).toFixed(5));

            if (item) {
                if (previousPoint != item.dataIndex) {
                    previousPoint = item.dataIndex;

                    $("#tooltipRatioChart").remove();
                    var x = item.datapoint[0].toFixed(0);
                    var logy = item.datapoint[1].toFixed(5);
                    var y = Math.pow(10, item.datapoint[1]).toFixed(5);

                    showTooltip(item.pageX - chart.offset().left, item.pageY - chart.offset().top,
                        "(" + x + ", logRatio=" + logy + ", ratio=" + y + ")");
                }
            }
            else {
                $("#tooltipRatioChart").remove();
                previousPoint = null;
            }
        });
    }
}
/* ---------- Ratio of Updates to Parameters Chart ---------- */
Ratio of Updates to Parameters Chart
Ratio of Updates to Parameters Chart
function renderUpdatesRatio(data) {
    var ratios = data["updateRatios"];
    var iter = data["scoresIter"];
    var chart = $("#updateRatioChart");
    if (chart.length) {
        var keys = Object.keys(ratios);
        var toPlot = [];
        var overallMax = -Number.MAX_VALUE;
        var overallMin = Number.MAX_VALUE;
        for (var i = 0; i < keys.length; i++) {
            var r = ratios[keys[i]];
            var pairs = [];
            for (var j = 0; j < r.length; j++) {
                pairs.push([iter[j], Math.log10(r[j])]);
            }
            toPlot.push({data: pairs, label: keys[i]});
            var thisMax = Math.max.apply(Math, r);
            var thisMin = Math.min.apply(Math, r);
            overallMax = Math.max(overallMax, thisMax);
            overallMin = Math.min(overallMin, thisMin);
        }
        if (overallMax == -Number.MAX_VALUE) overallMax = 1.0;
        if (overallMin == Number.MAX_VALUE) overallMin = 0.0;
        overallMax = Math.log10(overallMax);
        overallMin = Math.log10(overallMin);
        overallMin = Math.max(overallMin, -10);
        overallMax = Math.ceil(overallMax);
        overallMin = Math.floor(overallMin);
        var plot = $.plot(chart,
            toPlot, {
                series: {
                    lines: {
                        show: true,
                        lineWidth: 2
                    }
                },
                grid: {
                    hoverable: true,
                    clickable: true,
                    tickColor: "#dddddd",
                    borderWidth: 0
                },
                yaxis: {min: overallMin, max: overallMax},
                colors: ["#FA5833", "#2FABE9"]
            });
        function showTooltip(x, y, contents) {
            $('<div id="tooltipRatioChart">' + contents + '</div>').css({
                position: 'absolute',
                display: 'none',
                top: y + 8,
                left: x + 10,
                border: '1px solid #fdd',
                padding: '2px',
                'background-color': '#dfeffc',
                opacity: 0.80
            }).appendTo("#updateRatioChart").fadeIn(200);
        }
        var previousPoint = null;
        chart.bind("plothover", function (event, pos, item) {
            if (typeof pos.x == 'undefined') return;
            var xPos = pos.x.toFixed(0);
            $("#xRatio").text(xPos < 0 || xPos == "-0" ? "" : xPos);
            $("#yLogRatio").text(pos.y.toFixed(5));
            $("#yRatio").text(Math.pow(10, pos.y).toFixed(5));
            if (item) {
                if (previousPoint != item.dataIndex) {
                    previousPoint = item.dataIndex;
                    $("#tooltipRatioChart").remove();
                    var x = item.datapoint[0].toFixed(0);
                    var logy = item.datapoint[1].toFixed(5);
                    var y = Math.pow(10, item.datapoint[1]).toFixed(5);
                    showTooltip(item.pageX - chart.offset().left, item.pageY - chart.offset().top,
                        "(" + x + ", logRatio=" + logy + ", ratio=" + y + ")");
                }
            }
            else {
                $("#tooltipRatioChart").remove();
                previousPoint = null;
            }
        });
    }
}
function renderUpdatesRatio ( data ) { var ratios = data [ "updateRatios" ] ; var iter = data [ "scoresIter" ] ; var chart = $ ( "#updateRatioChart" ) ; if ( chart . length ) { var keys = Object . keys ( ratios ) ; var toPlot = [ ] ; var overallMax = - Number . MAX_VALUE ; var overallMin = Number . MAX_VALUE ; for ( var i = 0 ; i < keys . length ; i ++ ) { var r = ratios [ keys [ i ] ] ; var pairs = [ ] ; for ( var j = 0 ; j < r . length ; j ++ ) { pairs . push ( [ iter [ j ] , Math . log10 ( r [ j ] ) ] ) ; } toPlot . push ( { data : pairs , label : keys [ i ] } ) ; var thisMax = Math . max . apply ( Math , r ) ; var thisMin = Math . min . apply ( Math , r ) ; overallMax = Math . max ( overallMax , thisMax ) ; overallMin = Math . min ( overallMin , thisMin ) ; } if ( overallMax == - Number . MAX_VALUE ) overallMax = 1.0 ; if ( overallMin == Number . MAX_VALUE ) overallMin = 0.0 ; overallMax = Math . log10 ( overallMax ) ; overallMin = Math . log10 ( overallMin ) ; overallMin = Math . max ( overallMin , - 10 ) ; overallMax = Math . ceil ( overallMax ) ; overallMin = Math . floor ( overallMin ) ; var plot = $ . plot ( chart , toPlot , { series : { lines : { show : true , lineWidth : 2 } } , grid : { hoverable : true , clickable : true , tickColor : "#dddddd" , borderWidth : 0 } , yaxis : { min : overallMin , max : overallMax } , colors : [ "#FA5833" , "#2FABE9" ] } ) ; function showTooltip ( x , y , contents ) { $ ( '<div id="tooltipRatioChart">' + contents + '</div>' ) . css ( { position : 'absolute' , display : 'none' , top : y + 8 , left : x + 10 , border : '1px solid #fdd' , padding : '2px' , 'background-color' : '#dfeffc' , opacity : 0.80 } ) . appendTo ( "#updateRatioChart" ) . fadeIn ( 200 ) ; } var previousPoint = null ; chart . bind ( "plothover" , function ( event , pos , item ) { if ( typeof pos . x == 'undefined' ) return ; var xPos = pos . x . toFixed ( 0 ) ; $ ( "#xRatio" ) . text ( xPos < 0 || xPos == "-0" ? "" : xPos ) ; $ ( "#yLogRatio" ) . text ( pos . y . toFixed ( 5 ) ) ; $ ( "#yRatio" ) . text ( Math . pow ( 10 , pos . y ) . toFixed ( 5 ) ) ; if ( item ) { if ( previousPoint != item . dataIndex ) { previousPoint = item . dataIndex ; $ ( "#tooltipRatioChart" ) . remove ( ) ; var x = item . datapoint [ 0 ] . toFixed ( 0 ) ; var logy = item . datapoint [ 1 ] . toFixed ( 5 ) ; var y = Math . pow ( 10 , item . datapoint [ 1 ] ) . toFixed ( 5 ) ; showTooltip ( item . pageX - chart . offset ( ) . left , item . pageY - chart . offset ( ) . top , "(" + x + ", logRatio=" + logy + ", ratio=" + y + ")" ) ; } } else { $ ( "#tooltipRatioChart" ) . remove ( ) ; previousPoint = null ; } } ) ; } }
Ratio of Updates to Parameters Chart
Ratio of Updates to Parameters Chart
// points: {show: true}, // shadowSize: 2