Esempio n. 1
0
    def layout(self):

        style = {"height": f"{self.height}vh", "width": f"{self.width}%"}

        return html.Embed(src=self.pdf_url,
                          style=style,
                          type="application/pdf")
def div_report_content(app):
    return html.Div([
        html.Div(
            html.Embed(src=app.get_asset_url("pharma-report.pdf"),
                       width="100%",
                       height="1150px")),
    ])
Esempio n. 3
0
def toggle_modal(n_clicks_submit, n_clicks_close, is_open, * args, **kwargs):
    ''' Return the state of the modal '''

    body_div = html.Embed(
        src=VersionDetailView.as_view()),

    if n_clicks_submit or n_clicks_close:
        return not is_open
    return is_open
Esempio n. 4
0
def update_schematic(basin_code):
    basin_name = BASINS[basin_code].replace(' ', '_').lower()
    return [
        html.Embed(src=app.get_asset_url(
            'schematics/{}_schematic_simplified.gv.pdf?time={}'.format(
                basin_name, datetime.now())),
                   type='application/pdf',
                   className='schematic-pdf',
                   width="100%",
                   height="100%")
    ]
Esempio n. 5
0
def tab_one():
    """ Contents in the first tab 'Select Weather File'
    """
    return html.Div(
        id = "tab-one-container",
        className = "container-col",
        children = [
            html.Label('Copy paste a link from the map below'),
            dcc.Input(
                id = "input-url",
                value = 'https://energyplus.net/weather-download/north_and_central_america_wmo_region_4/USA/CA/USA_CA_Oakland.Intl.AP.724930_TMY/USA_CA_Oakland.Intl.AP.724930_TMY.epw', 
                type = 'text'
            ),
            html.Embed(
                id = "tab-one-map",
                src = "https://www.ladybug.tools/epwmap/"
            )
        ]
    )
Esempio n. 6
0
result_blurb = html.Div(
    dbc.Card([
        dbc.CardBody([
            html.H5("What's your political profile?", className='card-title'),
            html.P(re_bl),
            dbc.Button("Get My Results",
                       id="fade-transition-button",
                       className="mb-3",
                       n_clicks=0), fade
        ])
    ]))

result_card = dbc.Card([dbc.CardBody([dbc.Row([result_blurb])])])

survey_card = dbc.Card(
    [dbc.CardBody(dbc.Row([html.Embed(src=form, height=900, width=750)]))],
    style={
        'width': 'auto',
        'height': 'auto'
    })

app = JupyterDash(external_stylesheets=[dbc.themes.LITERA])
server = app.server

top_cell = dbc.Col([html.H2('Politics of Earth Dashboard')], width=12)
right_col = dbc.Col([survey_card], width=6)
left_col = dbc.Col([result_card], width=6)
app.layout = html.Div([dbc.Row([top_cell]), dbc.Row([left_col, right_col])])


@app.callback(
Esempio n. 7
0
            ],
                    width=6),
        ]),
        dbc.Row([
            dbc.Col([
                dcc.Graph(id='time-series-graph-sis'),
            ], width=12),
        ]),
        html.Hr(),
        dbc.Row([
            dbc.Col([html.H3("Lyapunov function of the SIS-Model")], width=12),
        ]),
        dbc.Row([
            dbc.Col([
                html.Embed(type="text/html",
                           src="/static/sis_lyapunov.html",
                           width="900",
                           height="600"),
            ],
                    width=12),
        ]),
        html.Div(id='dummy-div'),
    ],
    className='sir')


@app.callback(Output('mkd_r0', 'children'), [
    Input('beta', 'value'),
    Input('gamma', 'value'),
    Input('delta', 'value'),
    Input('sigma', 'value'),
    Input('epsilon', 'value'),
Esempio n. 8
0
def render_page_content(pathname):
    if pathname in ["/", "/page-1"]:
        return html.Div([
                dbc.Jumbotron([
                            html.H4("About the Data and the App", className="display-about"),
                            html.P(
                                "Getting insights from the docs",
                                className="lead",
                            ),
                            html.Hr(className="my-2"),
                            dcc.Markdown(
                                '''
                                Pellentesque posuere pellentesque imperde laoreet’s Velit leading pulvinar velit a hendrerit Donec non pellentesque jus businesses tincidunt. Suspendisse at maximus turpis, non loborsrt.

                                    Dolor sit amet consectetur elit sed do eiusmod tempor incididunt labore et dolore
                                    magna aliqua enim ad minim veniam quis nostrud exercitation ulac laboris aliquip
                                    ex ea commodo consequat duis aute irure.dolor in repre henderit in voluptate velit
                                    esse cillum dolore eu fugiat nulla pariatur excep teur sint cupidatat non proident.

                                Pellentesque posuere pellentesque imperde laoreet’s Velit leading pulvinar velit a hendrerit Donec non pellentesque jus businesses tincidunt. Suspendisse at maximus turpis, non loborsrt.

                                * consectetur elit sed do eius
                                * consectetur elit sed
                                * consectetur elit sed do
                                '''
                                ),
                        ])
        ])
    elif pathname == "/page-2":
        return html.Div([
                html.H3('Text Data', style={'font-weight': 'bold'}),
                html.P('Preprocessed: stopwords removed; words in original form; without numbers; predefined phrase linked by "_"'),
                dash_table.DataTable(
                    id='table',
                    # columns=[{"name": i, "id": i} for i in textdata.columns],
                    # data=textdata.to_dict('records'),

                    columns=[{"name": i, "id": i} for i in data[['FileID','Text','text']].columns],
                    data=data[['FileID','Text','text']].to_dict('records'),

                    editable=False,
                    filter_action="native",
                    sort_action="native",
                    sort_mode="multi",
                    column_selectable=False,
                    row_selectable=False,
                    row_deletable=False,
                    selected_columns=[],
                    selected_rows=[],
                    page_action="native",
                    page_current= 0,
                    page_size= 20,
                    # style_cell_conditional=[
                    #     {'if': {'column_id': 'Member'},
                    #      'width': '100px'},
                    # ]
                    style_data={
                        'whiteSpace': 'normal',
                        'height': 'auto'
                    },
                    style_cell={
                        # 'height': 'auto',
                        'minWidth': '20px', 'maxWidth': '300px',
                        # 'whiteSpace': 'normal',
                        'textAlign': 'left',
                        'verticalAlign': 'top',
                        'fontSize':12,
                    },
                )
            ])

    elif pathname in ["/page-3"]:
        return html.Div([
                        # Chart 1
                        dbc.Row([
                            dbc.Col([
                                html.H3('Summary Stats', style={'font-weight': 'bold'}),
                                html.P(
                                    id="description",
                                    children=dcc.Markdown(
                                      children=(
                                        '''
                                        Members' submissiong, Chair and Secretariat summaries/notes are not included.
                                        ''')
                                    )
                                ),
                                html.Br(),
                                html.H6('Number of Proposals by year', style={'font-weight': 'bold'}),
                            ], lg=10),
                        ]),
                        dbc.Row([
                            dbc.Col([
                                html.Label('Select Pillar:'),
                                dcc.Dropdown(
                                    id='stat-year-dropdown-pillar',
                                    options=[{'label': v, 'value': k}
                                                for k, v in dict_pillar.items()],
                                    multi=False,
                                    value= 'All',
                                ),
                            ], lg=4),
                            dbc.Col([
                                html.Label('Select Proponent:'),
                                dcc.Dropdown(
                                    id='stat-year-dropdown-proponent',
                                    options=[{'label': v, 'value': k}
                                                for k, v in dict_proponent.items()],
                                    multi=False,
                                    value= 'All',
                                ),
                            ], lg=4)
                        ]),
                        dbc.Row([
                            dbc.Col([
                                dcc.Graph(
                                    id='stat-plot-year-pillar-proponent'
                                ),
                            ], lg=10),
                        ]),

                        # Chart 2
                        dbc.Row([
                            dbc.Col([
                                html.Label('Select topic:'),
                                dcc.Dropdown(
                                    id='stat-year-dropdown-topic',
                                    options=[{'label': v, 'value': k}
                                                for k, v in dict_topic.items()],
                                    multi=False,
                                    value= 'All',
                                ),
                            ], lg=4),
                            dbc.Col([
                                html.Label('Select Proponent:'),
                                dcc.Dropdown(
                                    id='stat-year-dropdown-proponent2',
                                    options=[{'label': v, 'value': k}
                                                for k, v in dict_proponent.items()],
                                    multi=False,
                                    value= 'All',
                                ),
                            ], lg=4)
                        ]),
                        dbc.Row([
                            dbc.Col([
                                dcc.Graph(
                                    id='stat-plot-year-topic-proponent'
                                ),
                            ], lg=10),
                        ]),


                    ])

    elif pathname in ["/page-4"]:
        return html.Div([
                        dbc.Row([
                            # dbc.Col(lg=1),
                            dbc.Col([
                                html.H3('Similarity within topics', style={'font-weight': 'bold'}),
                                # html.H5('Updata on 14 June 2020'),
                                html.P(
                                    id="description",
                                    children=dcc.Markdown(
                                      children=(
                                        '''
                                        Similarity between two docs in a topic.
                                        ''')
                                    )
                                ),
                                html.Br(),
                                # html.H6('Number of Proposals by year', style={'font-weight': 'bold'}),
                                # dcc.Dropdown(
                                #     id='my-dropdown',
                                #     options=[{'label': v, 'value': k}
                                #                 for k, v in dict_pillar.items()],
                                #     multi=False,
                                #     value= [0,1,2,3,4,5,6,7,8,9],
                                # ),
                            ], lg=10),
                        ]),
                        dbc.Row([
                            dbc.Col([
                                html.Label('Select Topic:'),
                                dcc.Dropdown(
                                    id='plot-year-dropdown-pillar1',
                                    options=[{'label': v, 'value': k}
                                                for k, v in dict_topic.items()],
                                    multi=False,
                                    value= 'COT',
                                ),
                            ], lg=4),
                            # dbc.Col([
                            #     html.Label('Select Proponent:'),
                            #     dcc.Dropdown(
                            #         id='plot-year-dropdown-proponent1',
                            #         options=[{'label': v, 'value': k}
                            #                     for k, v in dict_proponent.items()],
                            #         multi=False,
                            #         value= 'All',
                            #     ),
                            # ], lg=4)
                        ]),
                        dbc.Row([
                            # dbc.Col(lg=1),
                            # dbc.Col([
                            #     dcc.Graph(
                            #         id='top_topics'
                            #     ),
                            # ], lg=3),
                            dbc.Col([
                                dcc.Graph(
                                    id='plot_year1'
                                ),
                            ], lg=10),
                        ]),
                    ])


    elif pathname in ["/page-5"]:
        # return html.H5("Content to be added page 2.")
        return html.Div([
                        dbc.Row([
                            # dbc.Col(lg=1),
                            dbc.Col([
                                html.H3('WordCloud by topic', style={'font-weight': 'bold'}),
                                # html.H5('Updata on 14 June 2020'),
                                html.P(
                                    id="description",
                                    children=dcc.Markdown(
                                      children=(
                                        '''
                                        Word frequency in a topic.
                                        ''')
                                    )
                                ),
                                html.Br(),
                            ], lg=10),
                        ]),
                        dbc.Row([
                            dbc.Col([
                                html.Label('Select Topic:'),
                                dcc.Dropdown(
                                    id='plot-year-dropdown-pillar2',
                                    options=[{'label': v, 'value': k}
                                                for k, v in dict_topic.items()],
                                    multi=False,
                                    value= 'COT',
                                ),
                            ], lg=4),
                        ]),
                        dbc.Row([
                            dbc.Col([
                                dcc.Graph(
                                    id='plot_year2'
                                ),
                            ], lg=10),
                        ]),
                    ])


    elif pathname in ["/page-6"]:
        return html.Div([
                        # html.H1('Title'),
                        html.H3('Networks: proposal proponents & document cross reference', style={'font-weight': 'bold'}),
                        html.Embed(src = "assets/network_proponent.html", width=850, height=850),
                        html.Embed(src = "assets/network_crossreference.html", width=850, height=850)
                        ])


    elif pathname in ["/page-7"]:
        return html.Div([
                        dbc.Row([
                            dbc.Col([
                                    html.H3('Term Frequency', style={'font-weight': 'bold'}),
                                    html.P(
                                        id="description",
                                        children=dcc.Markdown(
                                          children=(
                                            '''
                                            Term frequency across time
                                            ''')
                                        )
                                    ),

                            ]),

                            ]),
                        dbc.Row([
                                dbc.Col([
                                        dbc.Input(id='term-freq-input', value='tariff ams', type='text'),
                                        dbc.Button(id='term-freq-button', type='submit', children='Submit', className="mr-2"),
                                        html.P(id='term-freq-invalid'),
                                        ], lg=6),
                                ]),
                        dbc.Row([
                                dbc.Col([
                                        dcc.Graph(
                                            id='term-freq-plot'
                                            ),
                                        # dbc.Button(id='term-freq-button', type='submit', children='Submit', className="mr-2"),
                                        ], lg=10),
                                ])
                        ])
    # elif pathname in ["/page-8"]:
    #     return html.Div([
    #                     dbc.Row([
    #                         dbc.Col([
    #                                 html.H3('TF-IDF keywords', style={'font-weight': 'bold'}),
    #                                 html.P(
    #                                     id="description2",
    #                                     children=dcc.Markdown(
    #                                       children=(
    #                                         '''
    #                                         Keywords based on TF-IDF. Select documents
    #                                         ''')
    #                                     )
    #                                 ),
    #                         ]),
    #
    #                         ]),
    #                     dbc.Row([
    #                             dbc.Col([
    #                                     html.P(id='tfidf-invalid'),
    #                                     dcc.Dropdown(id='tfidf-dropdown',
    #                                                  multi=True,
    #                                                  value=['AIE-1', 'AIE-2','AIE-3','AIE-4','AIE-5'],
    #                                                  placeholder='Select members',
    #                                                  options=[{'label': country, 'value': country}
    #                                                           for country in allfileid]),
    #                                     ],lg=10),
    #                             ]),
    #                     dbc.Row([
    #                             dbc.Col([
    #                                     dcc.Graph(
    #                                         id='tfidf-plot'
    #                                         ),
    #                                     ], lg=10),
    #                             ])
    #                     ])


    # If the user tries to reach a different page, return a 404 message
    return dbc.Jumbotron(
        [
            html.H1("404: Not found", className="text-danger"),
            html.Hr(),
            html.P(f"The pathname {pathname} was not recognised..."),
        ]
    )
Esempio n. 9
0
            color='secondary',
            href="http://www.hani.co.kr/arti/opinion/editorial/home01.html"),
        dbc.Button('국민일보',
                   color='secondary',
                   href="http://www.kmib.co.kr/opinion/index.asp"),
        dbc.Button('세계일보',
                   color='secondary',
                   href="http://www.segye.com/news/opinion"),
        dbc.Button('문화일보',
                   color='secondary',
                   href="http://www.munhwa.com/news/section.html?sec=opinion"),
    ])
])
KR['T1,T1,1,0'] = html.Embed(src='https://news.naver.com/',
                             style={
                                 'width': '100%',
                                 'height': '700px'
                             })
KR['T1,T1,2,0'] = html.Embed(src='https://www.seoul.co.kr/',
                             style={
                                 'width': '100%',
                                 'height': '700px'
                             })
KR['T1,T1,3,0'] = html.Embed(src='https://www.chosun.com/',
                             style={
                                 'width': '100%',
                                 'height': '700px'
                             })
KR['T1,T1,4,0'] = html.Embed(src='https://www.donga.com/',
                             style={
                                 'width': '100%',
Esempio n. 10
0
            DENSO driving behavior data analytic platform is to analyze the realtime intersection
            traffic, including realtime speed prediction, aggressiveness prediction, driving behavior 
            interpretation and driving behavior prediction.
        """,
               style=dict(fontFamily='helvetica',
                          fontSize=15,
                          fontStyle='italic',
                          fontWeight='bold')),

        # html.Img(
        #     src=encode_image('./densoimg.png'),
        #     style=dict(
        #         height='220px',
        #     )
        # ),
        html.Embed(src="https://www.youtube.com/embed/1EiC9bvVGnk",
                   style=dict(width='490px', height='280px')),
        html.P(
            children="""
            Select (single) day and (multiple) hours.
        """,
            style=dict(
                fontFamily='helvetica',
                fontSize=15,
                fontStyle='italic',
                # fontWeight = 'bold'
            )),
        html.Div(
            dcc.DatePickerSingle(id='date',
                                 date=str(max_date_.date()),
                                 display_format='MMM Do, YY',
                                 max_date_allowed=str(max_date_.date()),
Esempio n. 11
0
def layout_graphs():
    return [
        dcc.Input(value='', type='hidden', id='load_info'),
        dcc.Input(value='', type='hidden', id='start_info'),
        dcc.Tabs(
            id="tabs",
            value='tab-preview',
            children=[
                dcc.Tab(disabled=True),
                dcc.Tab(
                    label='Preview',
                    value='tab-preview',
                    children=[dcc.Loading(dcc.Graph(id='graph_preview', ))],
                    id='preview_head'),
                dcc.Tab(label='Signal scale',
                        value='tab-raw',
                        children=[dcc.Loading(dcc.Graph(id='graph_raw', ))],
                        id='raw_head'),
                dcc.Tab(label='Base scale',
                        value='tab-base',
                        children=[dcc.Loading(dcc.Graph(id='graph_base', ))],
                        id='base_head'),
                dcc.Tab(
                    label='Base probability',
                    value='tab-prob',
                    children=[
                        html.
                        P('A logo with more then 200 Bases is unreadeable. '
                          'Use the slider or search to determine the shown range.'
                          ),
                        dcc.RangeSlider(min=0,
                                        max=200,
                                        value=[0],
                                        updatemode='drag',
                                        id='logo_range'),
                        dcc.Input(id='range_from', value='0', disabled=True),
                        ' to ',
                        dcc.Input(id='range_to', value='200', disabled=True),
                        dcc.Input(value='[0,200]',
                                  type='hidden',
                                  id='hidden_range'),
                        dcc.Loading([
                            dcc.Graph(id='graph_prob', ),
                        ]),
                        html.H2('Logo Options'),
                        dcc.RadioItems(
                            options=[
                                {
                                    'label': 'Up next',
                                    'value': 'up'
                                },
                                {
                                    'label': 'At call',
                                    'value': 'at'
                                },
                                # {'label': 'Around', 'value': 'ar'},
                            ],
                            value='up',
                            id="logo_options",
                            labelStyle={
                                'display': 'inline-block',
                                'padding': 10
                            })
                    ],
                    id='prob_head'),
            ]),
        html.Div([
            html.H2('Graph Options'),
            dcc.Checklist(options=[
                {
                    'label': 'Stack Traces',
                    'value': 'trace_stack'
                },
                {
                    'label': 'Normalize to 1',
                    'value': 'normalize'
                },
            ],
                          value=[],
                          id="graph_options",
                          labelStyle={
                              'display': 'inline-block',
                              'padding': 10
                          })
        ],
                 id='hide_options'),
        html.Embed(src='/logo.svg',
                   style={
                       'maxWidth': '20%',
                       'maxHeight': '60px',
                       'position': 'absolute',
                       'left': 0,
                       'top': 0
                   },
                   type='image/svg+xml'),
    ]
Esempio n. 12
0
            dcc.Markdown('''
                El gráfico treemap permite establecer la proporción del total en un grupo. En este caso, muestra
                la proporción de delitos cometidos dentro de una población que cometió una enésima reincidencia.
                El tamaño del cuadro es proporcional a la cantiadad de personas que cometieron ese delito. El color
                representa la gravedad del delito, donde azul son los menos graves, y rojo los más graves.

                Se evidencia que los delitos al patrimonio económico son los más cometidos, en especial, el hurto.
                A medida que reinciden, la proporción de hurto aumenta, y los delitos más graves disminuyen.
            ''')
        ], width={'size': 4}, className='aside-element', align='center')
    ]),
    dbc.Row([
        # Espacio para el gráfico
        dbc.Col([
            html.Div(className='div-line'),
            html.Embed(src=app.get_asset_url('chord1_2.html'),
                    height=900, width=900, id='chordplot')
        ], width={'size': 8}, className='page_content'),
        dbc.Col([
            html.H3(["Movimiento a través de diferentes delitos"]),
            html.H6('Seleccione el movimiento de reincidencias'),
            dcc.Dropdown(
                options=[
                    {'label': 'Primera a segunda', 'value': '1_2'},
                    {'label': 'Segunda a tercera', 'value': '2_3'},
                    {'label': 'Tercera a cuarta', 'value': '3_4'},
                    {'label': 'Cuarta a quinta', 'value': '4_5'},
                    {'label': 'Quinta a sexta', 'value': '5_6'},
                ],
                value='1_2',
                id='dd-chordplot'
            ),
Esempio n. 13
0
def update_srcs(tab, dropdown, like_drop):
	if tab == "general":
		logs = {}
		logs["m1k100"] = [-6462.09154358292,-6340.37086879552,-6297.57391880282,-6282.30502538016,-6276.19988314019,-6274.02381196260,-6268.83007396596,-6246.73007781273,-6194.89065546058,-6115.10283130740,-6020.23839539232,-5913.31081229047,-5782.09182240260,-5632.23649021301,-5488.69662657097,-5347.38900477074,-5195.29187404153,-5039.84046779837,-4888.47614631507,-4757.00555768855,-4649.14301019402,-4564.85511198811,-4496.76820797732,-4438.59095239576,-4388.21754939285,-4341.71105474559,-4299.11922697231,-4263.72348777955,-4238.55459957385,-4220.01811186889,-4205.74048210954,-4191.26055849156,-4173.21431875669,-4159.13522002199,-4149.10498484054,-4141.41655289405,-4135.18683408330,-4128.91148028142,-4122.34490296265,-4118.57268556118,-4114.88106582247,-4110.05132576683,-4104.43548119454,-4099.76883913956,-4096.78275895599,-4095.30052540388,-4094.23112703427,-4092.78429560967,-4089.80744295120]
		logs["m1k60"] = [-6588.41071670156,-6456.93296574020,-6380.84488916064,-6334.17969349749,-6305.26278821868,-6285.47553423376,-6264.29648806831,-6225.1187820855 ,-6147.09568604030,-6031.00973759455,-5896.75727516797,-5748.80942681650,-5598.54222940659,-5440.87290193891,-5293.01476632010,-5153.25352152069,-5010.42522991721,-4872.05638166323,-4760.49707163471,-4679.24341019759,-4613.16406026376,-4559.59543885232,-4519.53581020533,-4489.39878587855,-4464.83242040019,-4442.66600778893,-4422.07555083411,-4403.52567808136,-4388.52787013590,-4376.52584684355,-4364.68059133360,-4350.29361822767,-4335.40417240878,-4325.13251928619,-4318.89393630586,-4313.52909018317,-4308.35049571619,-4303.90129317774,-4301.14641314514,-4298.70655745297,-4295.86157587504,-4293.33103979812,-4291.20102133246,-4288.72050239015,-4285.59794493852,-4282.80632084538,-4280.93450567332,-4279.93251900799,-4281.25528613997]
		logs["m1k30"] = [-6602.997957314115,-6452.930935392313,-6356.998596355808,-6303.259083299326,-6264.951015596217,-6222.158070579215,-6150.260338681672,-6053.417212261178,-5978.891282476475,-5920.201839261273,-5849.711927302553,-5753.364171250366,-5629.711788481681,-5495.147762049949,-5365.355680463085,-5256.640551826355,-5167.142181966929,-5088.984344074387,-5019.901929822349,-4957.249325103242,-4902.038715949597,-4856.624388272188,-4821.828229235923,-4793.678812717629,-4769.688669551363,-4750.943663498081,-4736.563942602042,-4726.818217059233,-4720.007991229081,-4713.810401908677,-4707.835669676998,-4702.736568398963,-4698.413307378047,-4693.768437457142,-4689.008492252879,-4685.9759903855,-4683.827070388015,-4682.088710495721,-4680.680160699603,-4679.567080512961,-4678.669734173452,-4677.846192119866,-4676.885095703667,-4675.488381512922,-4673.364503175602,-4670.693814560007,-4668.289657111749,-4666.625742420942,-4665.592465210248]
		logs["m2k2"] = [-5147.62882957397,-5139.61333985323,-5129.10948060040,-5113.03667494961,-5088.31940817092,-5055.17142485208,-5020.19401928774,-4989.27250811269,-4956.46155246227,-4912.36158366347,-4851.13188705839,-4778.59759845215,-4709.44334485615,-4666.47452749112,-4645.23186352335,-4630.17605020536,-4613.16915638799,-4599.04419713003,-4589.8153982035 ,-4584.11552817770,-4580.34536487597,-4577.67028635773,-4575.79497306939,-4574.12331781325,-4572.48347958147,-4571.15864939006,-4569.94730890953,-4568.03962503683,-4565.19292979563,-4562.47309730113,-4560.76063796033,-4559.81099276038,-4559.20447194692,-4558.67453544225,-4558.04059847088,-4557.24211975859,-4556.35982649612,-4555.46438750547,-4554.55123805976,-4553.48596026180,-4551.67491007425,-4549.17883071004,-4545.65140520674,-4542.27536017065,-4540.86512053585,-4539.90868003175,-4539.06329602976,-4537.54884655405,-4534.85673061538]
		logs["m2k3"] = [-5141.40098605726,-5117.00042477788,-5075.09715038904,-5009.60465875568,-4925.25416942506,-4833.33367406717,-4747.87937791034,-4675.01754339700,-4612.14111509349,-4557.93695927632,-4511.90165534370,-4474.79466267383,-4450.98322048711,-4435.56779784641,-4424.21970586988,-4412.66907824977,-4399.13548404804,-4385.14977636284,-4374.13792733156,-4365.99519284917,-4359.46481847401,-4352.98085137105,-4344.26541413360,-4335.33813156121,-4329.73759027541,-4326.16387667100,-4323.42495067471,-4321.08537895154,-4318.67581443881,-4316.51731158923,-4315.22777386474,-4314.26246589296,-4313.40537394444,-4312.67441505587,-4312.06557621387,-4311.52297808728,-4311.00368983301,-4310.50309300722,-4310.05168959643,-4309.67407435755,-4309.35935259445,-4309.08208446938,-4308.76545705652,-4307.74171303717,-4305.21901959940,-4304.05625689810,-4303.55996736031,-4303.12146485638,-4302.70547724785]
		logs["m3k2"] = [-5073.32148857528,-4924.59859634054,-4763.23422714566,-4629.51702016516,-4519.13370528411,-4442.59980222449,-4392.12776142497,-4362.31298100541,-4345.25722578853,-4333.65477744068,-4323.94738050502,-4317.05204507996,-4313.47791705873,-4311.19176020563,-4308.89235002752,-4305.43162930160,-4301.67623373465,-4299.46154119264,-4297.71884361235,-4295.49094494541,-4292.29559817779,-4283.92924578904,-4276.04097664977,-4271.98453261176,-4267.72497380626,-4262.44441185951,-4254.19246048032,-4249.84226338576,-4247.66538668057,-4246.24741273367,-4245.05661981182,-4244.24022589532,-4243.66203791551,-4243.0074977889 ,-4241.93604015413,-4240.21839225017,-4237.37032192273,-4236.04276483024,-4235.54200253718,-4235.09551503032,-4234.65216895028,-4234.36169690820,-4234.23715969629,-4234.18268274112,-4234.15092469255,-4234.12533309467,-4234.09708273164,-4234.05784858803,-4233.99816874424]
		logs["m3k3"] = [-5151.95234135422,-5146.49016700418,-5139.51771594515,-5129.21672906220,-5113.03042639564,-5084.65041185265,-5030.12570191784,-4932.13495088327,-4796.96629667299,-4668.30341674053,-4576.77007053109,-4519.69167013055,-4483.38270544141,-4450.84077756246,-4419.10365804653,-4386.82979544157,-4356.37361480498,-4324.21332272771,-4284.42719946902,-4231.10304479439,-4168.39257044636,-4118.64584556176,-4089.48076197504,-4070.91976578055,-4056.87814833904,-4043.13322651050,-4034.70467588738,-4028.54456200587,-4022.51427028272,-4016.79592059789,-4012.12984059341,-4007.92093092973,-4003.61463082207,-3998.23356174323,-3989.26900964932,-3982.79576223769,-3979.01936784975,-3975.61068593092,-3970.65235528796,-3965.37680974870,-3962.33184357689,-3959.30145308807,-3955.87560554122,-3952.04497237340,-3948.76877296735,-3945.83610717950,-3942.41547575515,-3938.06689011001,-3933.81500235083]
		logs["m3k5"] = [-5150.981471356111,-5146.42043572257 ,-5139.149566647848,-5123.922294412329,-5086.751205081557,-5002.773644692339,-4880.233947308009,-4785.611488099677,-4731.51935665819 ,-4684.522958007244,-4630.160598908475,-4570.501016935102,-4514.604243490069,-4465.919570291554,-4419.950728314028,-4372.844941235325,-4323.223091684944,-4270.770606271465,-4215.524121403597,-4158.964308528821,-4102.446248978187,-4045.541959162809,-3986.756689351532,-3928.929573177988,-3873.902384513081,-3823.108277836281,-3777.222795422293,-3736.383930011351,-3699.815497818022,-3665.457095027970,-3636.948957653102,-3615.096503164045,-3598.361506945749,-3585.170423959242,-3574.294498015043,-3564.756236307322,-3555.937565482507,-3548.172046379646,-3541.016361921309,-3534.584348205447,-3529.449135098980,-3525.202884190873,-3521.404845318946,-3517.870129782244,-3514.259956593460,-3510.258256747413,-3505.474947343345,-3500.472779583405,-3496.440683346912]
		logs["m5k2"] = [-5149.99836011207,-5145.70100499605,-5139.93237843028,-5132.21761682127,-5122.28511381510,-5108.32366103391,-5083.20410277153,-5027.70706387640,-4911.14997574654,-4747.49703782798,-4622.27056636782,-4557.44091262661,-4530.24775958611,-4516.03108238095,-4503.76246397663,-4489.69896728640,-4471.73454917635,-4448.61248477031,-4420.15272653973,-4387.18316274456,-4350.72498865365,-4312.87651107002,-4276.81525320009,-4245.84644324888,-4219.96751040801,-4195.52830280880,-4171.91900001465,-4151.86780265604,-4135.29328854088,-4118.13987334420,-4096.72956074516,-4073.96734592934,-4053.75563756006,-4035.91931755190,-4020.55175265923,-4007.21976623525,-3993.89818820343,-3983.25672270955,-3974.87482079213,-3967.38626677184,-3960.28288783875,-3954.91929745565,-3951.22454587275,-3947.29064459442,-3941.84554422891,-3934.80503986663,-3928.83153255217,-3924.29883074322,-3920.47481812770]

		traces = []
		if type(like_drop) == list:
			for t in like_drop:
				traces.append(go.Scatter(
				x = numpy.arange(0, 50, 1),
				y = logs[t],
				text = t,
				name = t
				))
		else:
			traces.append(go.Scatter(
				x = numpy.arange(0, 50, 1),
				y = logs[like_drop],
				text = like_drop,
				name = like_drop
				))

		figure = {
					'data': traces,
					'layout': go.Layout(
							title = 'Log likelihood',
							xaxis=dict(
								title = 'iterations',
								autorange=True,
								showgrid=False,
								zeroline=False,
								showline=False,
								ticks='',
							),
							yaxis=dict(
								title = 'log likelihood',
								autorange=True,
								showgrid=False,
								zeroline=False,
								showline=False,
								ticks='',
							),
						)
				}
		return "",figure
	elif tab == 'songs':
		#print("DROP: ", dropdown)
		div = html.Div([
			html.Audio(id='song', src=static_song_route + dropdown + ".mp3", controls=True, preload="auto"),
			html.Div(children=''),
#  			 html.Img(id='image'),
			html.Embed(id='pdf', src=static_song_route + dropdown + ".pdf", width='800', height='1000', type="application/pdf")
		])
		
		return div,{}
# initialize Dash object
app = dash.Dash()

# define dropdown whose options are embed urls
dd = dcc.Dropdown(
    id='dropdown',
    options=[{
        'label': k,
        'value': v
    } for k, v in embed_urls.iteritems()],
    value=embed_urls.keys()[0],
)

# embedded plot element whose `src` parameter will
# be populated and updated with dropdown values
plot = html.Embed(id='plot', height=600, width=1000)

# set div containing dropdown and embedded plot
app.layout = html.Div(children=[dd, plot])


# update `src` parameter on dropdown select action
@app.callback(Output(component_id='plot', component_property='src'),
              [Input(component_id='dropdown', component_property='value')])
def update_plot_src(input_value):

    return input_value


if __name__ == '__main__':
Esempio n. 15
0
    def __init__(self):
        self.name = 'K-Modes' # Nombre del algoritmo
        
        self.aside = html.Div([ # Elemento aside correspondiente a este modelo
            html.H3('Clustering'),
            dcc.Markdown('''
                Clustering es la agrupación de un set de objetos, de tal manera que los que estén en el mismo grupo (Cluster)
                son lo más similares entre sí a comparación con los otros grupos. Es una actividad exploratoria de datos, y una
                técnica estadística común para el análsis de datos.

                Un modelo de clustering fue usado para agrupar a la población reincidentes de acuerdo a algunas variables 
                seleccionadas, esto para obtener una caracterización de la población. Se utilizó el método de clustering K-modes,
                obteniendo seis clusters. Estos clusters pueden verse representados en la gráfica de la derecha, donde cada 
                eje representa uno de los tres componentes principales.
            '''),
            html.Div(className='div-line'),
            html.H3('K-Modes'),
            dcc.Markdown('''
                K-Modes es un método de clustering utilizado para variables categóricas. Este método define clusters basado en el 
                número de categorías coincidentes entre los diferentes puntos del Dataset. Este método es alternativo al mucho más 
                conocido método de K-Means, que es utilizado para información numérica tomando como base la distancia euclidiana.
            '''),
            html.Div(className='div-line'),
            html.H3('Resultados'),
            dcc.Markdown('''
                Según la estructura de los datos, se determinó que lo óptimo es definir tres clusters. Las carácterísticas de cada
                cluster definido se encuentran en los desplegables bajo la gráfica.
            ''')

        ], className='aside')
        
        self.layout = html.Div([ # Contenido de la página para este modelo
            html.Div([
                html.H3('Clasificación propuesta utilizando K-Modes'),
                html.Embed(
                    src=app.get_asset_url('kmodes.html'),
                    height=900, width=900
                ),
            ],),
            html.Div([
                html.H3(['Se identificaron los siguientes tres clusters con las siguientes características:']),
                html.Div([
                    make_item(
                        0, 
                        dcc.Markdown("""
                        Los individuos del Cluster 0 comparten las siguientes características:

                        * Entre 28 y 30 años de edad
                        * Completaron la primaria
                        * Realizaron actividades (educación, trabajo o enseñanza) durante la reclusión
                        * En estado intramuros al momento del ingreso
                        * Tienen hijos menores
                        * Han reincidido solo una vez
                        * El Hurto es el delito que más cometen
                        * Han cometido solo un delito
                        * Los delitos contra el patrimonio económico son los que más cometen
                        * En una escala de donde 1 es el delito menos grave, y 5 el más grave, la máxima gravedad es 2
                        """)
                    ), 
                    make_item(
                        1,
                        dcc.Markdown("""
                        Los individuos del Cluster 1 comparten las siguientes características:

                        * Entre 31 y 35 años de edad
                        * Completaron la primaria
                        * Realizaron actividades (educación, trabajo o enseñanza) durante la reclusión
                        * En estado intramuros al momento del ingreso
                        * Tienen hijos menores
                        * Han reincidido solo una vez
                        * El Tráfico, fabricación o porte de estupefacientes es el delito que más cometen
                        * Han cometido solo un delito
                        * Los delitos contra la salud pública los que más cometen
                        * En una escala de donde 1 es el delito menos grave, y 5 el más grave, la máxima gravedad es 4
                        """)
                    ),
                    make_item(
                        2,
                        dcc.Markdown("""
                        Los individuos del Cluster 2 comparten las siguientes características:

                        * Entre 33 y 36 años de edad
                        * Completaron la primaria
                        * Realizaron actividades (educación, trabajo o enseñanza) durante la reclusión
                        * En estado intramuros al momento del ingreso
                        * Tienen hijos menores
                        * Han reincidido solo una vez
                        * La fabricación, tráfico y porte de armas de fuego o municiones es el delito que más cometen
                        * Han cometido un delito
                        * Los delitos contra la seguridad pública son los que más cometen
                        * En una escala de donde 1 es el delito menos grave, y 5 el más grave, la máxima gravedad es 5
                        """)
                    ),
                ], className="accordion")
            ], className='content_box', style={'text-align': 'left'})
        ])