prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>tastiapp.py<|end_file_name|><|fim▁begin|>from bottle import route, template, error, request, static_file, get, post from index import get_index from bmarks import get_bmarks from tags import get_tags from add import add_tags from bmarklet import get_bmarklet from account import get_account from edit_tags i...
bmarks
<|file_name|>tastiapp.py<|end_file_name|><|fim▁begin|>from bottle import route, template, error, request, static_file, get, post from index import get_index from bmarks import get_bmarks from tags import get_tags from add import add_tags from bmarklet import get_bmarklet from account import get_account from edit_tags i...
bmarks
<|file_name|>tastiapp.py<|end_file_name|><|fim▁begin|>from bottle import route, template, error, request, static_file, get, post from index import get_index from bmarks import get_bmarks from tags import get_tags from add import add_tags from bmarklet import get_bmarklet from account import get_account from edit_tags i...
bmarks
<|file_name|>tastiapp.py<|end_file_name|><|fim▁begin|>from bottle import route, template, error, request, static_file, get, post from index import get_index from bmarks import get_bmarks from tags import get_tags from add import add_tags from bmarklet import get_bmarklet from account import get_account from edit_tags i...
bmarks
<|file_name|>tastiapp.py<|end_file_name|><|fim▁begin|>from bottle import route, template, error, request, static_file, get, post from index import get_index from bmarks import get_bmarks from tags import get_tags from add import add_tags from bmarklet import get_bmarklet from account import get_account from edit_tags i...
bmarks
<|file_name|>tastiapp.py<|end_file_name|><|fim▁begin|>from bottle import route, template, error, request, static_file, get, post from index import get_index from bmarks import get_bmarks from tags import get_tags from add import add_tags from bmarklet import get_bmarklet from account import get_account from edit_tags i...
bmarks
<|file_name|>tastiapp.py<|end_file_name|><|fim▁begin|>from bottle import route, template, error, request, static_file, get, post from index import get_index from bmarks import get_bmarks from tags import get_tags from add import add_tags from bmarklet import get_bmarklet from account import get_account from edit_tags i...
bmarks
<|file_name|>tastiapp.py<|end_file_name|><|fim▁begin|>from bottle import route, template, error, request, static_file, get, post from index import get_index from bmarks import get_bmarks from tags import get_tags from add import add_tags from bmarklet import get_bmarklet from account import get_account from edit_tags i...
bmarks
<|file_name|>tastiapp.py<|end_file_name|><|fim▁begin|>from bottle import route, template, error, request, static_file, get, post from index import get_index from bmarks import get_bmarks from tags import get_tags from add import add_tags from bmarklet import get_bmarklet from account import get_account from edit_tags i...
bmarks
<|file_name|>tastiapp.py<|end_file_name|><|fim▁begin|>from bottle import route, template, error, request, static_file, get, post from index import get_index from bmarks import get_bmarks from tags import get_tags from add import add_tags from bmarklet import get_bmarklet from account import get_account from edit_tags i...
send_css
<|file_name|>tastiapp.py<|end_file_name|><|fim▁begin|>from bottle import route, template, error, request, static_file, get, post from index import get_index from bmarks import get_bmarks from tags import get_tags from add import add_tags from bmarklet import get_bmarklet from account import get_account from edit_tags i...
send_js
<|file_name|>tastiapp.py<|end_file_name|><|fim▁begin|>from bottle import route, template, error, request, static_file, get, post from index import get_index from bmarks import get_bmarks from tags import get_tags from add import add_tags from bmarklet import get_bmarklet from account import get_account from edit_tags i...
send_img
<|file_name|>tastiapp.py<|end_file_name|><|fim▁begin|>from bottle import route, template, error, request, static_file, get, post from index import get_index from bmarks import get_bmarks from tags import get_tags from add import add_tags from bmarklet import get_bmarklet from account import get_account from edit_tags i...
send_font
<|file_name|>tastiapp.py<|end_file_name|><|fim▁begin|>from bottle import route, template, error, request, static_file, get, post from index import get_index from bmarks import get_bmarks from tags import get_tags from add import add_tags from bmarklet import get_bmarklet from account import get_account from edit_tags i...
handle404
<|file_name|>tastiapp.py<|end_file_name|><|fim▁begin|>from bottle import route, template, error, request, static_file, get, post from index import get_index from bmarks import get_bmarks from tags import get_tags from add import add_tags from bmarklet import get_bmarklet from account import get_account from edit_tags i...
handle500
<|file_name|>player_reinforce_rnn_2.py<|end_file_name|><|fim▁begin|>from players.player import player from auxiliar.aux_plot import * import random from collections import deque import sys sys.path.append('..') import tensorblock as tb import numpy as np import tensorflow as tf # PLAYER REINFORCE RNN class player_...
curr_states[i,j,:,:] = self.experiences[ i + j ][1]
<|file_name|>player_reinforce_rnn_2.py<|end_file_name|><|fim▁begin|>from players.player import player from auxiliar.aux_plot import * import random from collections import deque import sys sys.path.append('..') import tensorblock as tb import numpy as np import tensorflow as tf # PLAYER REINFORCE RNN class player_...
def __init__(self): player.__init__(self) self.experiences = deque() # CHOOSE NEXT ACTION def act(self, state): return self.calculate(state) # CALCULATE NETWORK def calculate(self, state): size = len( self.experiences ) if size < self.NUM_FRAMES: ...
<|file_name|>player_reinforce_rnn_2.py<|end_file_name|><|fim▁begin|>from players.player import player from auxiliar.aux_plot import * import random from collections import deque import sys sys.path.append('..') import tensorblock as tb import numpy as np import tensorflow as tf # PLAYER REINFORCE RNN class player_...
player.__init__(self) self.experiences = deque()
<|file_name|>player_reinforce_rnn_2.py<|end_file_name|><|fim▁begin|>from players.player import player from auxiliar.aux_plot import * import random from collections import deque import sys sys.path.append('..') import tensorblock as tb import numpy as np import tensorflow as tf # PLAYER REINFORCE RNN class player_...
return self.calculate(state)
<|file_name|>player_reinforce_rnn_2.py<|end_file_name|><|fim▁begin|>from players.player import player from auxiliar.aux_plot import * import random from collections import deque import sys sys.path.append('..') import tensorblock as tb import numpy as np import tensorflow as tf # PLAYER REINFORCE RNN class player_...
size = len( self.experiences ) if size < self.NUM_FRAMES: return self.create_random_action() states = np.zeros( (self.NUM_FRAMES , self.obsv_shape[0], self.obsv_shape[1] ) ) for i , j in enumerate( range( size - self.NUM_FRAMES , size ) ): states[i] = self.exp...
<|file_name|>player_reinforce_rnn_2.py<|end_file_name|><|fim▁begin|>from players.player import player from auxiliar.aux_plot import * import random from collections import deque import sys sys.path.append('..') import tensorblock as tb import numpy as np import tensorflow as tf # PLAYER REINFORCE RNN class player_...
self.brain.addInput( shape = [ None , self.num_actions ] , name = 'Actions' ) self.brain.addInput( shape = [ None ] , name = 'Target' ) # Operations self.brain.addOperation( function = tb.ops.pgcost, input = [ 'Output', 'Actions'...
<|file_name|>player_reinforce_rnn_2.py<|end_file_name|><|fim▁begin|>from players.player import player from auxiliar.aux_plot import * import random from collections import deque import sys sys.path.append('..') import tensorblock as tb import numpy as np import tensorflow as tf # PLAYER REINFORCE RNN class player_...
self.experiences.append((prev_state, curr_state, actn, rewd, done)) batchsize = len( self.experiences ) - self.NUM_FRAMES + 1 # Check for Train if done: # Select Batch batch = self.experiences # Separate Batch Data prev_states = np.z...
<|file_name|>player_reinforce_rnn_2.py<|end_file_name|><|fim▁begin|>from players.player import player from auxiliar.aux_plot import * import random from collections import deque import sys sys.path.append('..') import tensorblock as tb import numpy as np import tensorflow as tf # PLAYER REINFORCE RNN class player_...
return self.create_random_action()
<|file_name|>player_reinforce_rnn_2.py<|end_file_name|><|fim▁begin|>from players.player import player from auxiliar.aux_plot import * import random from collections import deque import sys sys.path.append('..') import tensorblock as tb import numpy as np import tensorflow as tf # PLAYER REINFORCE RNN class player_...
batch = self.experiences # Separate Batch Data prev_states = np.zeros( ( batchsize , self.NUM_FRAMES , self.obsv_shape[0], self.obsv_shape[1] ) ) curr_states = np.zeros( ( batchsize , self.NUM_FRAMES , self.obsv_shape[0], self.obsv_shape[1] ) ) actions =...
<|file_name|>player_reinforce_rnn_2.py<|end_file_name|><|fim▁begin|>from players.player import player from auxiliar.aux_plot import * import random from collections import deque import sys sys.path.append('..') import tensorblock as tb import numpy as np import tensorflow as tf # PLAYER REINFORCE RNN class player_...
running_add = 0
<|file_name|>player_reinforce_rnn_2.py<|end_file_name|><|fim▁begin|>from players.player import player from auxiliar.aux_plot import * import random from collections import deque import sys sys.path.append('..') import tensorblock as tb import numpy as np import tensorflow as tf # PLAYER REINFORCE RNN class player_...
__init__
<|file_name|>player_reinforce_rnn_2.py<|end_file_name|><|fim▁begin|>from players.player import player from auxiliar.aux_plot import * import random from collections import deque import sys sys.path.append('..') import tensorblock as tb import numpy as np import tensorflow as tf # PLAYER REINFORCE RNN class player_...
act
<|file_name|>player_reinforce_rnn_2.py<|end_file_name|><|fim▁begin|>from players.player import player from auxiliar.aux_plot import * import random from collections import deque import sys sys.path.append('..') import tensorblock as tb import numpy as np import tensorflow as tf # PLAYER REINFORCE RNN class player_...
calculate
<|file_name|>player_reinforce_rnn_2.py<|end_file_name|><|fim▁begin|>from players.player import player from auxiliar.aux_plot import * import random from collections import deque import sys sys.path.append('..') import tensorblock as tb import numpy as np import tensorflow as tf # PLAYER REINFORCE RNN class player_...
operations
<|file_name|>player_reinforce_rnn_2.py<|end_file_name|><|fim▁begin|>from players.player import player from auxiliar.aux_plot import * import random from collections import deque import sys sys.path.append('..') import tensorblock as tb import numpy as np import tensorflow as tf # PLAYER REINFORCE RNN class player_...
train
<|file_name|>net.py<|end_file_name|><|fim▁begin|># Copyright 2018 Flight Lab authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Un...
import socket def get_ip():
<|file_name|>net.py<|end_file_name|><|fim▁begin|># Copyright 2018 Flight Lab authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Un...
"""Get primary IP (the one with a default route) of local machine. This works on both Linux and Windows platforms, and doesn't require working internet connection. """ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: # doesn't even have to be reachable s.connect(('10.255.255.255', 1)) ...
<|file_name|>net.py<|end_file_name|><|fim▁begin|># Copyright 2018 Flight Lab authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Un...
get_ip
<|file_name|>err_2021_001_logging_perm.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.<|fim▁hole|># # Unless required by applicable law or agreed to in writing, software # d...
# You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0
<|file_name|>err_2021_001_logging_perm.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICE...
project_ids = {c.project_id for c in gke.get_clusters(context).values()} for pid in project_ids: iam.get_project_policy(pid)
<|file_name|>err_2021_001_logging_perm.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICE...
clusters = gke.get_clusters(context) iam_policy = iam.get_project_policy(context.project_id) if not clusters: report.add_skipped(None, 'no clusters found') for _, c in sorted(clusters.items()): if not c.has_logging_enabled(): report.add_skipped(c, 'logging disabled') else: # Verify servi...
<|file_name|>err_2021_001_logging_perm.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICE...
report.add_skipped(None, 'no clusters found')
<|file_name|>err_2021_001_logging_perm.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICE...
report.add_skipped(c, 'logging disabled')
<|file_name|>err_2021_001_logging_perm.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICE...
for np in c.nodepools: sa = np.service_account if not iam.is_service_account_enabled(sa, context.project_id): report.add_failed(np, f'service account disabled or deleted: {sa}') elif not iam_policy.has_role_permissions(f'serviceAccount:{sa}', ROLE): report.add_failed(np...
<|file_name|>err_2021_001_logging_perm.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICE...
report.add_failed(np, f'service account disabled or deleted: {sa}')
<|file_name|>err_2021_001_logging_perm.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICE...
report.add_failed(np, f'service account: {sa}\nmissing role: {ROLE}')
<|file_name|>err_2021_001_logging_perm.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICE...
report.add_ok(np)
<|file_name|>err_2021_001_logging_perm.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICE...
prefetch_rule
<|file_name|>err_2021_001_logging_perm.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICE...
run_rule
<|file_name|>test_realizer_arbitrary_reordering.py<|end_file_name|><|fim▁begin|>import unittest import tagging class TestRealizerArbitraryReordering(unittest.TestCase): """ Tests for the realizer with arbitrary reordering enabled. """ def test_realize_output_in_order(self): """ ...
expected = "word2 word1 and word3 "
<|file_name|>test_realizer_arbitrary_reordering.py<|end_file_name|><|fim▁begin|>import unittest import tagging class TestRealizerArbitraryReordering(unittest.TestCase): <|fim_middle|> if __name__ == '__main__': unittest.main() <|fim▁end|>
""" Tests for the realizer with arbitrary reordering enabled. """ def test_realize_output_in_order(self): """ Test for when source tokens occur in the same relative order in the target string """ editing_task = tagging.EditingTask(...
<|file_name|>test_realizer_arbitrary_reordering.py<|end_file_name|><|fim▁begin|>import unittest import tagging class TestRealizerArbitraryReordering(unittest.TestCase): """ Tests for the realizer with arbitrary reordering enabled. """ def test_realize_output_in_order(self): <|fim_m...
""" Test for when source tokens occur in the same relative order in the target string """ editing_task = tagging.EditingTask(["word1 word2 <::::> word3 "]) tags_str = ['KEEP|0', 'KEEP|1', 'KEEP|and', 'DELETE', 'KEEP|3'] tags = [tagging.Tag(ta...
<|file_name|>test_realizer_arbitrary_reordering.py<|end_file_name|><|fim▁begin|>import unittest import tagging class TestRealizerArbitraryReordering(unittest.TestCase): """ Tests for the realizer with arbitrary reordering enabled. """ def test_realize_output_in_order(self): """ ...
""" Test for when the source tokens do not occur in the same relative order in the target string """ editing_task = tagging.EditingTask(["word1 word2 <::::> word3 "]) tags_str = ['KEEP|1', 'KEEP|0', 'KEEP|and', 'DELETE', 'KEEP|3'] tags = [tagg...
<|file_name|>test_realizer_arbitrary_reordering.py<|end_file_name|><|fim▁begin|>import unittest import tagging class TestRealizerArbitraryReordering(unittest.TestCase): """ Tests for the realizer with arbitrary reordering enabled. """ def test_realize_output_in_order(self): """ ...
unittest.main()
<|file_name|>test_realizer_arbitrary_reordering.py<|end_file_name|><|fim▁begin|>import unittest import tagging class TestRealizerArbitraryReordering(unittest.TestCase): """ Tests for the realizer with arbitrary reordering enabled. """ def <|fim_middle|>(self): """ Test ...
test_realize_output_in_order
<|file_name|>test_realizer_arbitrary_reordering.py<|end_file_name|><|fim▁begin|>import unittest import tagging class TestRealizerArbitraryReordering(unittest.TestCase): """ Tests for the realizer with arbitrary reordering enabled. """ def test_realize_output_in_order(self): """ ...
test_realize_output_out_of_order
<|file_name|>resources.py<|end_file_name|><|fim▁begin|># Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
ROUTER_CONTROLLER = 'router_controller'
<|file_name|>fetch.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2017, Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # This is a virtual module that is entirely implemented as an action plugin and runs on the c...
C(fail_when) or C(ignore_errors) to get this ability. They may
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from flask_appconfig import AppConfig from flask_wtf import Form, RecaptchaField from flask_wtf.file import FileField from wtforms import TextField, HiddenField, ValidationError, RadioField,\ BooleanField, SubmitField, IntegerField, FormField, valida...
from flask import Flask, render_template, flash from flask_material_lite import Material_Lite
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from flask import Flask, render_template, flash from flask_material_lite import Material_Lite from flask_appconfig import AppConfig from flask_wtf import Form, RecaptchaField from flask_wtf.file import FileField from wtforms import TextField, HiddenField, Validation...
country_code = IntegerField('Country Code', [validators.required()]) area_code = IntegerField('Area Code/Exchange', [validators.required()]) number = TextField('Number')
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from flask import Flask, render_template, flash from flask_material_lite import Material_Lite from flask_appconfig import AppConfig from flask_wtf import Form, RecaptchaField from flask_wtf.file import FileField from wtforms import TextField, HiddenField, Validation...
field1 = TextField('First Field', description='This is field one.') field2 = TextField('Second Field', description='This is field two.', validators=[Required()]) hidden_field = HiddenField('You cannot see this', description='Nope') recaptcha = RecaptchaField('A sample recaptcha fi...
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from flask import Flask, render_template, flash from flask_material_lite import Material_Lite from flask_appconfig import AppConfig from flask_wtf import Form, RecaptchaField from flask_wtf.file import FileField from wtforms import TextField, HiddenField, Validation...
raise ValidationError('Always wrong')
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from flask import Flask, render_template, flash from flask_material_lite import Material_Lite from flask_appconfig import AppConfig from flask_wtf import Form, RecaptchaField from flask_wtf.file import FileField from wtforms import TextField, HiddenField, Validation...
app = Flask(__name__) AppConfig(app, configfile) # Flask-Appconfig is not necessary, but # highly recommend =) # https://github.com/mbr/flask-appconfig Material_Lite(app) # in a real app, these should be configured through Flask-Appconfig...
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from flask import Flask, render_template, flash from flask_material_lite import Material_Lite from flask_appconfig import AppConfig from flask_wtf import Form, RecaptchaField from flask_wtf.file import FileField from wtforms import TextField, HiddenField, Validation...
form = ExampleForm() form.validate_on_submit() # to get error messages to the browser flash('critical message', 'critical') flash('error message', 'error') flash('warning message', 'warning') flash('info message', 'info') flash('debug message', 'debug') f...
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from flask import Flask, render_template, flash from flask_material_lite import Material_Lite from flask_appconfig import AppConfig from flask_wtf import Form, RecaptchaField from flask_wtf.file import FileField from wtforms import TextField, HiddenField, Validation...
create_app().run(debug=True)
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from flask import Flask, render_template, flash from flask_material_lite import Material_Lite from flask_appconfig import AppConfig from flask_wtf import Form, RecaptchaField from flask_wtf.file import FileField from wtforms import TextField, HiddenField, Validation...
validate_hidden_field
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from flask import Flask, render_template, flash from flask_material_lite import Material_Lite from flask_appconfig import AppConfig from flask_wtf import Form, RecaptchaField from flask_wtf.file import FileField from wtforms import TextField, HiddenField, Validation...
create_app
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from flask import Flask, render_template, flash from flask_material_lite import Material_Lite from flask_appconfig import AppConfig from flask_wtf import Form, RecaptchaField from flask_wtf.file import FileField from wtforms import TextField, HiddenField, Validation...
index
<|file_name|>bpr.py<|end_file_name|><|fim▁begin|># Author: Immanuel Bayer # License: BSD 3 clause import ffm import numpy as np from .base import FactorizationMachine from sklearn.utils.testing import assert_array_equal from .validation import check_array, assert_all_finite <|fim▁hole|> Parameters ---------- ...
class FMRecommender(FactorizationMachine): """ Factorization Machine Recommender with pairwise (BPR) loss solver.
<|file_name|>bpr.py<|end_file_name|><|fim▁begin|># Author: Immanuel Bayer # License: BSD 3 clause import ffm import numpy as np from .base import FactorizationMachine from sklearn.utils.testing import assert_array_equal from .validation import check_array, assert_all_finite class FMRecommender(FactorizationMachine):...
""" Factorization Machine Recommender with pairwise (BPR) loss solver. Parameters ---------- n_iter : int, optional The number of interations of individual samples . init_stdev: float, optional Sets the stdev for the initialization of the parameter random_state: int, optional ...
<|file_name|>bpr.py<|end_file_name|><|fim▁begin|># Author: Immanuel Bayer # License: BSD 3 clause import ffm import numpy as np from .base import FactorizationMachine from sklearn.utils.testing import assert_array_equal from .validation import check_array, assert_all_finite class FMRecommender(FactorizationMachine):...
super(FMRecommender, self).\ __init__(n_iter=n_iter, init_stdev=init_stdev, rank=rank, random_state=random_state) if (l2_reg != 0): self.l2_reg_V = l2_reg self.l2_reg_w = l2_reg else: self.l2_reg_w = l2_reg_w self.l...
<|file_name|>bpr.py<|end_file_name|><|fim▁begin|># Author: Immanuel Bayer # License: BSD 3 clause import ffm import numpy as np from .base import FactorizationMachine from sklearn.utils.testing import assert_array_equal from .validation import check_array, assert_all_finite class FMRecommender(FactorizationMachine):...
""" Fit model with specified loss. Parameters ---------- X : scipy.sparse.csc_matrix, (n_samples, n_features) y : float | ndarray, shape = (n_compares, 2) Each row `i` defines a pair of samples such that the first returns a high value then the se...
<|file_name|>bpr.py<|end_file_name|><|fim▁begin|># Author: Immanuel Bayer # License: BSD 3 clause import ffm import numpy as np from .base import FactorizationMachine from sklearn.utils.testing import assert_array_equal from .validation import check_array, assert_all_finite class FMRecommender(FactorizationMachine):...
self.l2_reg_V = l2_reg self.l2_reg_w = l2_reg
<|file_name|>bpr.py<|end_file_name|><|fim▁begin|># Author: Immanuel Bayer # License: BSD 3 clause import ffm import numpy as np from .base import FactorizationMachine from sklearn.utils.testing import assert_array_equal from .validation import check_array, assert_all_finite class FMRecommender(FactorizationMachine):...
self.l2_reg_w = l2_reg_w self.l2_reg_V = l2_reg_V
<|file_name|>bpr.py<|end_file_name|><|fim▁begin|># Author: Immanuel Bayer # License: BSD 3 clause import ffm import numpy as np from .base import FactorizationMachine from sklearn.utils.testing import assert_array_equal from .validation import check_array, assert_all_finite class FMRecommender(FactorizationMachine):...
__init__
<|file_name|>bpr.py<|end_file_name|><|fim▁begin|># Author: Immanuel Bayer # License: BSD 3 clause import ffm import numpy as np from .base import FactorizationMachine from sklearn.utils.testing import assert_array_equal from .validation import check_array, assert_all_finite class FMRecommender(FactorizationMachine):...
fit
<|file_name|>HHPH2013data_to_burnman.py<|end_file_name|><|fim▁begin|># BurnMan - a lower mantle toolkit # Copyright (C) 2012-2014, Myhill, R., Heister, T., Unterborn, C., Rose, I. and Cottaar, S. # Released under GPL v2 or later. # This is a standalone program that converts a tabulated version of the Stixrude and Lith...
print 'class', m[0].lower(), '(Mineral):' print ' def __init__(self):' print ''.join([' formula=\'',m[1],'\'']) print ' formula = dictionarize_formula(formula)'
<|file_name|>HHPH2013data_to_burnman.py<|end_file_name|><|fim▁begin|># BurnMan - a lower mantle toolkit # Copyright (C) 2012-2014, Myhill, R., Heister, T., Unterborn, C., Rose, I. and Cottaar, S. # Released under GPL v2 or later. # This is a standalone program that converts a tabulated version of the Stixrude and Lith...
f=open(datafile,'r') ds=[] for line in f: ds.append(line.decode('utf-8').split()) return ds
<|file_name|>HHPH2013data_to_burnman.py<|end_file_name|><|fim▁begin|># BurnMan - a lower mantle toolkit # Copyright (C) 2012-2014, Myhill, R., Heister, T., Unterborn, C., Rose, I. and Cottaar, S. # Released under GPL v2 or later. # This is a standalone program that converts a tabulated version of the Stixrude and Lith...
param_names=m
<|file_name|>HHPH2013data_to_burnman.py<|end_file_name|><|fim▁begin|># BurnMan - a lower mantle toolkit # Copyright (C) 2012-2014, Myhill, R., Heister, T., Unterborn, C., Rose, I. and Cottaar, S. # Released under GPL v2 or later. # This is a standalone program that converts a tabulated version of the Stixrude and Lith...
print 'class', m[0].lower(), '(Mineral):' print ' def __init__(self):' print ''.join([' formula=\'',m[1],'\'']) print ' formula = dictionarize_formula(formula)' print ' self.params = {' print ''.join([' \'name\': \'', m[0], '\',']) ...
<|file_name|>HHPH2013data_to_burnman.py<|end_file_name|><|fim▁begin|># BurnMan - a lower mantle toolkit # Copyright (C) 2012-2014, Myhill, R., Heister, T., Unterborn, C., Rose, I. and Cottaar, S. # Released under GPL v2 or later. # This is a standalone program that converts a tabulated version of the Stixrude and Lith...
print ' \''+param_names[pid]+'\':', float(param)*param_scales[pid], ','
<|file_name|>HHPH2013data_to_burnman.py<|end_file_name|><|fim▁begin|># BurnMan - a lower mantle toolkit # Copyright (C) 2012-2014, Myhill, R., Heister, T., Unterborn, C., Rose, I. and Cottaar, S. # Released under GPL v2 or later. # This is a standalone program that converts a tabulated version of the Stixrude and Lith...
print ' \''+param_names[pid]+'\':', float(param)*param_scales[pid], ','
<|file_name|>HHPH2013data_to_burnman.py<|end_file_name|><|fim▁begin|># BurnMan - a lower mantle toolkit # Copyright (C) 2012-2014, Myhill, R., Heister, T., Unterborn, C., Rose, I. and Cottaar, S. # Released under GPL v2 or later. # This is a standalone program that converts a tabulated version of the Stixrude and Lith...
read_dataset
<|file_name|>re.4.py<|end_file_name|><|fim▁begin|>import re<|fim▁hole|>p = re.compile(r'(\w+) (\w+)(?P<sign>.*)', re.DOTALL) print re.DOTALL print "p.pattern:", p.pattern print "p.flags:", p.flags print "p.groups:", p.groups print "p.groupindex:", p.groupindex<|fim▁end|>
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>"""redblue_project URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to u...
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf
<|file_name|>mixup.py<|end_file_name|><|fim▁begin|># Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
x, labels_x = self.augment(xt_in, tf.one_hot(l_in, self.nclass), **kwargs) logits_x = get_logits(x)
<|file_name|>mixup.py<|end_file_name|><|fim▁begin|># Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
def augment(self, x, l, beta, **kwargs): del kwargs mix = tf.distributions.Beta(beta, beta).sample([tf.shape(x)[0], 1, 1, 1]) mix = tf.maximum(mix, 1 - mix) xmix = x * mix + x[::-1] * (1 - mix) lmix = l * mix[:, :, 0, 0] + l[::-1] * (1 - mix[:, :, 0, 0]) return xmix, ...
<|file_name|>mixup.py<|end_file_name|><|fim▁begin|># Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
del kwargs mix = tf.distributions.Beta(beta, beta).sample([tf.shape(x)[0], 1, 1, 1]) mix = tf.maximum(mix, 1 - mix) xmix = x * mix + x[::-1] * (1 - mix) lmix = l * mix[:, :, 0, 0] + l[::-1] * (1 - mix[:, :, 0, 0]) return xmix, lmix
<|file_name|>mixup.py<|end_file_name|><|fim▁begin|># Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
hwc = [self.dataset.height, self.dataset.width, self.dataset.colors] xt_in = tf.placeholder(tf.float32, [batch] + hwc, 'xt') # For training x_in = tf.placeholder(tf.float32, [None] + hwc, 'x') y_in = tf.placeholder(tf.float32, [batch] + hwc, 'y') l_in = tf.placeholder(tf.int32, ...
<|file_name|>mixup.py<|end_file_name|><|fim▁begin|># Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
logits = classifier(x, training=True) return logits
<|file_name|>mixup.py<|end_file_name|><|fim▁begin|># Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
utils.setup_main() del argv # Unused. dataset = data.DATASETS()[FLAGS.dataset]() log_width = utils.ilog2(dataset.width) model = Mixup( os.path.join(FLAGS.train_dir, dataset.name), dataset, lr=FLAGS.lr, wd=FLAGS.wd, arch=FLAGS.arch, batch=FLAGS.batch, ...
<|file_name|>mixup.py<|end_file_name|><|fim▁begin|># Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
utils.setup_tf() flags.DEFINE_float('wd', 0.02, 'Weight decay.') flags.DEFINE_float('ema', 0.999, 'Exponential moving average of params.') flags.DEFINE_float('beta', 0.5, 'Mixup beta distribution.') flags.DEFINE_integer('scales', 0, 'Number of 2x2 downscalings in the classifier.') flags.DEFINE_i...
<|file_name|>mixup.py<|end_file_name|><|fim▁begin|># Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
augment
<|file_name|>mixup.py<|end_file_name|><|fim▁begin|># Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
model
<|file_name|>mixup.py<|end_file_name|><|fim▁begin|># Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
get_logits
<|file_name|>mixup.py<|end_file_name|><|fim▁begin|># Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
main
<|file_name|>dn.py<|end_file_name|><|fim▁begin|># # Copyright 2015 Fasih # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
def cn(self): return self._cn
<|file_name|>dn.py<|end_file_name|><|fim▁begin|># # Copyright 2015 Fasih # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
def __init__(self, dn): self._dn = dn.replace(',dn', '') self._cn = [] self._displayName = [] self._givenName = [] self._homePhone = [] self._homePostalAddress = [] self._mail = [] self._mobile = [] self._o = [] self._objectClass = [] self._sn = [] self._telephoneNumber...
<|file_name|>dn.py<|end_file_name|><|fim▁begin|># # Copyright 2015 Fasih # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
self._dn = dn.replace(',dn', '') self._cn = [] self._displayName = [] self._givenName = [] self._homePhone = [] self._homePostalAddress = [] self._mail = [] self._mobile = [] self._o = [] self._objectClass = [] self._sn = [] self._telephoneNumber = [] self._title = []
<|file_name|>dn.py<|end_file_name|><|fim▁begin|># # Copyright 2015 Fasih # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
return self._dn
<|file_name|>dn.py<|end_file_name|><|fim▁begin|># # Copyright 2015 Fasih # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
return self._cn
<|file_name|>dn.py<|end_file_name|><|fim▁begin|># # Copyright 2015 Fasih # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
self._cn.append(v)
<|file_name|>dn.py<|end_file_name|><|fim▁begin|># # Copyright 2015 Fasih # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
return self._displayName
<|file_name|>dn.py<|end_file_name|><|fim▁begin|># # Copyright 2015 Fasih # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
self._displayName.append(v)
<|file_name|>dn.py<|end_file_name|><|fim▁begin|># # Copyright 2015 Fasih # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
return self._givenName