• 0
Votes
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 195

Backtrace:

File: /home/u125378470/domains/lawhelpguru.org/public_html/application/views/question.php
Line: 195
Function: _error_handler

File: /home/u125378470/domains/lawhelpguru.org/public_html/application/controllers/Questions.php
Line: 416
Function: view

File: /home/u125378470/domains/lawhelpguru.org/public_html/index.php
Line: 315
Function: require_once

<button aria-describedby="--stacks-s-tooltip-rvvyaoj4" aria-label="Bookmark" aria-pressed="false" class="js-bookmark-btn s-btn s-btn__unset c-pointer py4 js-gps-track" data-controller="s-tooltip" data-gps-track="post.click({ item: 1, priv: 0, post_type: 1 })" data-s-tooltip-placement="right" data-selected-classes="fc-yellow-600"></button><svg aria-hidden="true" class="mln2 mr0 svg-icon iconHistory" height="18" viewbox="0 0 19 18" width="19"></svg>

 

I have a list of unique words. I have to calculate the hamming distance between two list of strings. Suppose the list of strings are:

a = ['a' , 'b', 'c' ]
b = ['b' , 'a', 'd' ]

And let the unique words list be:

u = ['a', 'b', 'c', 'd', 'e']

I need to create two lists from a and b that will be of the same length as u. Suppose the lists are va and vb. Each element of va and vb will either be 0 or 1. It will be 1 if corresponding element of u exists in a or b and 0 otherwise. For example,

va = [1, 1, 1, 0, 0]
vb = [1, 1, 0, 1, 0]

I will then calculate the hamming distance between va and vb using the sklearn's pairwise distance metric. What is the most efficient way to calculate va and vb from a, b and u?