Skip to content

Instantly share code, notes, and snippets.

View tridungduong16's full-sized avatar

Tri Duong tridungduong16

  • Sydney
View GitHub Profile

Natural language processing

SVD (Singular Value Decomposition)

dungduong

  • A (mxn)
  • U (mxr)
  • D (rxr)
  • V (nxr)
@tridungduong16
tridungduong16 / pytorch.md
Last active August 11, 2018 14:13
Pytorch learning

Variable and Tensor

a = torch.Tensor(
    [
        [1,2],
        [3,4]
    ]
)
@tridungduong16
tridungduong16 / regex.md
Last active August 10, 2018 03:31
Regular Experession

Macth phrase without number

phrase= "The Knicks game yesterday was great!!! The Knicks won 112-92 at MSG"
patterns= [r'((?:[^\d\W]+\s*)+)']
for p in patterns:
    match= re.findall(p, phrase)
    print(match)

Types of query

Match query

Là truy vấn chuẩn để thực hiện full text query. Bao gồm truy vấn kết hợp và truy vấn cụm từ hoặc gần đúng. Match query chấp nhận văn bản, số, ngày tháng. Match query trả về các document chứa ít nhất 1 trong các từ trong truy vấn.

{
    "query" : {
        "match" : {
@tridungduong16
tridungduong16 / keras.py
Last active August 3, 2018 02:52
Python Note
### Create model in Keras
model = Sequential()
model.add(Dense(100, activation='relu', input_shape = input_shape))
model.add(Dense(100, activation='relu'))
model.add(Dense(2, activation='softmax'))
#model.compile(optimizer, loss=None, metrics=None, loss_weights=None, sample_weight_mode=None, weighted_metrics=None, target_tensors=None)
model.compile(optimizer = 'adam', loss = 'categorical_crossentropy',metrics=['accuracy'] )