partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
grid_visual
This function displays a grid of images to show full misclassification :param data: grid data of the form; [nb_classes : nb_classes : img_rows : img_cols : nb_channels] :return: if necessary, the matplot figure to reuse
cleverhans/plot/pyplot_image.py
def grid_visual(data): """ This function displays a grid of images to show full misclassification :param data: grid data of the form; [nb_classes : nb_classes : img_rows : img_cols : nb_channels] :return: if necessary, the matplot figure to reuse """ import matplotlib.pyplot as plt # Ensure interac...
def grid_visual(data): """ This function displays a grid of images to show full misclassification :param data: grid data of the form; [nb_classes : nb_classes : img_rows : img_cols : nb_channels] :return: if necessary, the matplot figure to reuse """ import matplotlib.pyplot as plt # Ensure interac...
[ "This", "function", "displays", "a", "grid", "of", "images", "to", "show", "full", "misclassification", ":", "param", "data", ":", "grid", "data", "of", "the", "form", ";", "[", "nb_classes", ":", "nb_classes", ":", "img_rows", ":", "img_cols", ":", "nb_ch...
tensorflow/cleverhans
python
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/plot/pyplot_image.py#L51-L81
[ "def", "grid_visual", "(", "data", ")", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "# Ensure interactive mode is disabled and initialize our graph", "plt", ".", "ioff", "(", ")", "figure", "=", "plt", ".", "figure", "(", ")", "figure", ".", "canvas...
97488e215760547b81afc53f5e5de8ba7da5bd98
train
get_logits_over_interval
Get logits when the input is perturbed in an interval in adv direction. Args: sess: Tf session model: Model for which we wish to get logits. x_data: Numpy array corresponding to single data. point of shape [height, width, channels]. fgsm_params: Parameters for generating adversa...
cleverhans/plot/pyplot_image.py
def get_logits_over_interval(sess, model, x_data, fgsm_params, min_epsilon=-10., max_epsilon=10., num_points=21): """Get logits when the input is perturbed in an interval in adv direction. Args: sess: Tf session model: Model for which we wish to...
def get_logits_over_interval(sess, model, x_data, fgsm_params, min_epsilon=-10., max_epsilon=10., num_points=21): """Get logits when the input is perturbed in an interval in adv direction. Args: sess: Tf session model: Model for which we wish to...
[ "Get", "logits", "when", "the", "input", "is", "perturbed", "in", "an", "interval", "in", "adv", "direction", "." ]
tensorflow/cleverhans
python
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/plot/pyplot_image.py#L84-L137
[ "def", "get_logits_over_interval", "(", "sess", ",", "model", ",", "x_data", ",", "fgsm_params", ",", "min_epsilon", "=", "-", "10.", ",", "max_epsilon", "=", "10.", ",", "num_points", "=", "21", ")", ":", "# Get the height, width and number of channels", "height"...
97488e215760547b81afc53f5e5de8ba7da5bd98
train
linear_extrapolation_plot
Generate linear extrapolation plot. Args: log_prob_adv_array: Numpy array containing log probabilities y: Tf placeholder for the labels file_name: Plot filename min_epsilon: Minimum value of epsilon over the interval max_epsilon: Maximum value of epsilon over the interval num_poin...
cleverhans/plot/pyplot_image.py
def linear_extrapolation_plot(log_prob_adv_array, y, file_name, min_epsilon=-10, max_epsilon=10, num_points=21): """Generate linear extrapolation plot. Args: log_prob_adv_array: Numpy array containing log probabilities y: Tf placeholder for th...
def linear_extrapolation_plot(log_prob_adv_array, y, file_name, min_epsilon=-10, max_epsilon=10, num_points=21): """Generate linear extrapolation plot. Args: log_prob_adv_array: Numpy array containing log probabilities y: Tf placeholder for th...
[ "Generate", "linear", "extrapolation", "plot", "." ]
tensorflow/cleverhans
python
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/plot/pyplot_image.py#L139-L182
[ "def", "linear_extrapolation_plot", "(", "log_prob_adv_array", ",", "y", ",", "file_name", ",", "min_epsilon", "=", "-", "10", ",", "max_epsilon", "=", "10", ",", "num_points", "=", "21", ")", ":", "import", "matplotlib", "matplotlib", ".", "use", "(", "'Agg...
97488e215760547b81afc53f5e5de8ba7da5bd98
train
IQFeedTool._send_cmd
Encode IQFeed API messages.
contrib/utils/iqfeed-to-influxdb.py
def _send_cmd(self, cmd: str): """Encode IQFeed API messages.""" self._sock.sendall(cmd.encode(encoding='latin-1', errors='strict'))
def _send_cmd(self, cmd: str): """Encode IQFeed API messages.""" self._sock.sendall(cmd.encode(encoding='latin-1', errors='strict'))
[ "Encode", "IQFeed", "API", "messages", "." ]
backtrader/backtrader
python
https://github.com/backtrader/backtrader/blob/59ee9521f9887c2a1030c6f1db8c918a5816fd64/contrib/utils/iqfeed-to-influxdb.py#L59-L61
[ "def", "_send_cmd", "(", "self", ",", "cmd", ":", "str", ")", ":", "self", ".", "_sock", ".", "sendall", "(", "cmd", ".", "encode", "(", "encoding", "=", "'latin-1'", ",", "errors", "=", "'strict'", ")", ")" ]
59ee9521f9887c2a1030c6f1db8c918a5816fd64
train
IQFeedTool.iq_query
Send data query to IQFeed API.
contrib/utils/iqfeed-to-influxdb.py
def iq_query(self, message: str): """Send data query to IQFeed API.""" end_msg = '!ENDMSG!' recv_buffer = 4096 # Send the historical data request message and buffer the data self._send_cmd(message) chunk = "" data = "" while True: chunk = sel...
def iq_query(self, message: str): """Send data query to IQFeed API.""" end_msg = '!ENDMSG!' recv_buffer = 4096 # Send the historical data request message and buffer the data self._send_cmd(message) chunk = "" data = "" while True: chunk = sel...
[ "Send", "data", "query", "to", "IQFeed", "API", "." ]
backtrader/backtrader
python
https://github.com/backtrader/backtrader/blob/59ee9521f9887c2a1030c6f1db8c918a5816fd64/contrib/utils/iqfeed-to-influxdb.py#L63-L90
[ "def", "iq_query", "(", "self", ",", "message", ":", "str", ")", ":", "end_msg", "=", "'!ENDMSG!'", "recv_buffer", "=", "4096", "# Send the historical data request message and buffer the data", "self", ".", "_send_cmd", "(", "message", ")", "chunk", "=", "\"\"", "...
59ee9521f9887c2a1030c6f1db8c918a5816fd64
train
IQFeedTool.get_historical_minute_data
Request historical 5 minute data from DTN.
contrib/utils/iqfeed-to-influxdb.py
def get_historical_minute_data(self, ticker: str): """Request historical 5 minute data from DTN.""" start = self._start stop = self._stop if len(stop) > 4: stop = stop[:4] if len(start) > 4: start = start[:4] for year in range(int(start), int(st...
def get_historical_minute_data(self, ticker: str): """Request historical 5 minute data from DTN.""" start = self._start stop = self._stop if len(stop) > 4: stop = stop[:4] if len(start) > 4: start = start[:4] for year in range(int(start), int(st...
[ "Request", "historical", "5", "minute", "data", "from", "DTN", "." ]
backtrader/backtrader
python
https://github.com/backtrader/backtrader/blob/59ee9521f9887c2a1030c6f1db8c918a5816fd64/contrib/utils/iqfeed-to-influxdb.py#L92-L118
[ "def", "get_historical_minute_data", "(", "self", ",", "ticker", ":", "str", ")", ":", "start", "=", "self", ".", "_start", "stop", "=", "self", ".", "_stop", "if", "len", "(", "stop", ")", ">", "4", ":", "stop", "=", "stop", "[", ":", "4", "]", ...
59ee9521f9887c2a1030c6f1db8c918a5816fd64
train
IQFeedTool.add_data_to_df
Build Pandas Dataframe in memory
contrib/utils/iqfeed-to-influxdb.py
def add_data_to_df(self, data: np.array): """Build Pandas Dataframe in memory""" col_names = ['high_p', 'low_p', 'open_p', 'close_p', 'volume', 'oi'] data = np.array(data).reshape(-1, len(col_names) + 1) df = pd.DataFrame(data=data[:, 1:], index=data[:, 0], co...
def add_data_to_df(self, data: np.array): """Build Pandas Dataframe in memory""" col_names = ['high_p', 'low_p', 'open_p', 'close_p', 'volume', 'oi'] data = np.array(data).reshape(-1, len(col_names) + 1) df = pd.DataFrame(data=data[:, 1:], index=data[:, 0], co...
[ "Build", "Pandas", "Dataframe", "in", "memory" ]
backtrader/backtrader
python
https://github.com/backtrader/backtrader/blob/59ee9521f9887c2a1030c6f1db8c918a5816fd64/contrib/utils/iqfeed-to-influxdb.py#L120-L142
[ "def", "add_data_to_df", "(", "self", ",", "data", ":", "np", ".", "array", ")", ":", "col_names", "=", "[", "'high_p'", ",", "'low_p'", ",", "'open_p'", ",", "'close_p'", ",", "'volume'", ",", "'oi'", "]", "data", "=", "np", ".", "array", "(", "data...
59ee9521f9887c2a1030c6f1db8c918a5816fd64
train
IQFeedTool.get_tickers_from_file
Load ticker list from txt file
contrib/utils/iqfeed-to-influxdb.py
def get_tickers_from_file(self, filename): """Load ticker list from txt file""" if not os.path.exists(filename): log.error("Ticker List file does not exist: %s", filename) tickers = [] with io.open(filename, 'r') as fd: for ticker in fd: tickers.a...
def get_tickers_from_file(self, filename): """Load ticker list from txt file""" if not os.path.exists(filename): log.error("Ticker List file does not exist: %s", filename) tickers = [] with io.open(filename, 'r') as fd: for ticker in fd: tickers.a...
[ "Load", "ticker", "list", "from", "txt", "file" ]
backtrader/backtrader
python
https://github.com/backtrader/backtrader/blob/59ee9521f9887c2a1030c6f1db8c918a5816fd64/contrib/utils/iqfeed-to-influxdb.py#L144-L153
[ "def", "get_tickers_from_file", "(", "self", ",", "filename", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "filename", ")", ":", "log", ".", "error", "(", "\"Ticker List file does not exist: %s\"", ",", "filename", ")", "tickers", "=", "[", ...
59ee9521f9887c2a1030c6f1db8c918a5816fd64
train
InfluxDBTool.write_dataframe_to_idb
Write Pandas Dataframe to InfluxDB database
contrib/utils/influxdb-import.py
def write_dataframe_to_idb(self, ticker): """Write Pandas Dataframe to InfluxDB database""" cachepath = self._cache cachefile = ('%s/%s-1M.csv.gz' % (cachepath, ticker)) if not os.path.exists(cachefile): log.warn('Import file does not exist: %s' % (cache...
def write_dataframe_to_idb(self, ticker): """Write Pandas Dataframe to InfluxDB database""" cachepath = self._cache cachefile = ('%s/%s-1M.csv.gz' % (cachepath, ticker)) if not os.path.exists(cachefile): log.warn('Import file does not exist: %s' % (cache...
[ "Write", "Pandas", "Dataframe", "to", "InfluxDB", "database" ]
backtrader/backtrader
python
https://github.com/backtrader/backtrader/blob/59ee9521f9887c2a1030c6f1db8c918a5816fd64/contrib/utils/influxdb-import.py#L29-L49
[ "def", "write_dataframe_to_idb", "(", "self", ",", "ticker", ")", ":", "cachepath", "=", "self", ".", "_cache", "cachefile", "=", "(", "'%s/%s-1M.csv.gz'", "%", "(", "cachepath", ",", "ticker", ")", ")", "if", "not", "os", ".", "path", ".", "exists", "("...
59ee9521f9887c2a1030c6f1db8c918a5816fd64
train
MultiCursor.connect
connect events
backtrader/plot/multicursor.py
def connect(self): """connect events""" self._cidmotion = self.canvas.mpl_connect('motion_notify_event', self.onmove) self._ciddraw = self.canvas.mpl_connect('draw_event', self.clear)
def connect(self): """connect events""" self._cidmotion = self.canvas.mpl_connect('motion_notify_event', self.onmove) self._ciddraw = self.canvas.mpl_connect('draw_event', self.clear)
[ "connect", "events" ]
backtrader/backtrader
python
https://github.com/backtrader/backtrader/blob/59ee9521f9887c2a1030c6f1db8c918a5816fd64/backtrader/plot/multicursor.py#L173-L177
[ "def", "connect", "(", "self", ")", ":", "self", ".", "_cidmotion", "=", "self", ".", "canvas", ".", "mpl_connect", "(", "'motion_notify_event'", ",", "self", ".", "onmove", ")", "self", ".", "_ciddraw", "=", "self", ".", "canvas", ".", "mpl_connect", "(...
59ee9521f9887c2a1030c6f1db8c918a5816fd64
train
MultiCursor.disconnect
disconnect events
backtrader/plot/multicursor.py
def disconnect(self): """disconnect events""" self.canvas.mpl_disconnect(self._cidmotion) self.canvas.mpl_disconnect(self._ciddraw)
def disconnect(self): """disconnect events""" self.canvas.mpl_disconnect(self._cidmotion) self.canvas.mpl_disconnect(self._ciddraw)
[ "disconnect", "events" ]
backtrader/backtrader
python
https://github.com/backtrader/backtrader/blob/59ee9521f9887c2a1030c6f1db8c918a5816fd64/backtrader/plot/multicursor.py#L179-L182
[ "def", "disconnect", "(", "self", ")", ":", "self", ".", "canvas", ".", "mpl_disconnect", "(", "self", ".", "_cidmotion", ")", "self", ".", "canvas", ".", "mpl_disconnect", "(", "self", ".", "_ciddraw", ")" ]
59ee9521f9887c2a1030c6f1db8c918a5816fd64
train
WindowsInIDE.connect
Connect to window and set it foreground Args: **kwargs: optional arguments Returns: None
playground/win_ide.py
def connect(self, **kwargs): """ Connect to window and set it foreground Args: **kwargs: optional arguments Returns: None """ self.app = self._app.connect(**kwargs) try: self._top_window = self.app.top_window().wrapper_object...
def connect(self, **kwargs): """ Connect to window and set it foreground Args: **kwargs: optional arguments Returns: None """ self.app = self._app.connect(**kwargs) try: self._top_window = self.app.top_window().wrapper_object...
[ "Connect", "to", "window", "and", "set", "it", "foreground" ]
AirtestProject/Airtest
python
https://github.com/AirtestProject/Airtest/blob/21583da2698a601cd632228228fc16d41f60a517/playground/win_ide.py#L19-L35
[ "def", "connect", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "app", "=", "self", ".", "_app", ".", "connect", "(", "*", "*", "kwargs", ")", "try", ":", "self", ".", "_top_window", "=", "self", ".", "app", ".", "top_window", "(",...
21583da2698a601cd632228228fc16d41f60a517
train
WindowsInIDE.get_rect
Get rectangle of app or desktop resolution Returns: RECT(left, top, right, bottom)
playground/win_ide.py
def get_rect(self): """ Get rectangle of app or desktop resolution Returns: RECT(left, top, right, bottom) """ if self.handle: left, top, right, bottom = win32gui.GetWindowRect(self.handle) return RECT(left, top, right, bottom) else: ...
def get_rect(self): """ Get rectangle of app or desktop resolution Returns: RECT(left, top, right, bottom) """ if self.handle: left, top, right, bottom = win32gui.GetWindowRect(self.handle) return RECT(left, top, right, bottom) else: ...
[ "Get", "rectangle", "of", "app", "or", "desktop", "resolution" ]
AirtestProject/Airtest
python
https://github.com/AirtestProject/Airtest/blob/21583da2698a601cd632228228fc16d41f60a517/playground/win_ide.py#L37-L51
[ "def", "get_rect", "(", "self", ")", ":", "if", "self", ".", "handle", ":", "left", ",", "top", ",", "right", ",", "bottom", "=", "win32gui", ".", "GetWindowRect", "(", "self", ".", "handle", ")", "return", "RECT", "(", "left", ",", "top", ",", "ri...
21583da2698a601cd632228228fc16d41f60a517
train
WindowsInIDE.snapshot
Take a screenshot and save it to `tmp.png` filename by default Args: filename: name of file where to store the screenshot Returns: display the screenshot
playground/win_ide.py
def snapshot(self, filename="tmp.png"): """ Take a screenshot and save it to `tmp.png` filename by default Args: filename: name of file where to store the screenshot Returns: display the screenshot """ if not filename: filename = "tm...
def snapshot(self, filename="tmp.png"): """ Take a screenshot and save it to `tmp.png` filename by default Args: filename: name of file where to store the screenshot Returns: display the screenshot """ if not filename: filename = "tm...
[ "Take", "a", "screenshot", "and", "save", "it", "to", "tmp", ".", "png", "filename", "by", "default" ]
AirtestProject/Airtest
python
https://github.com/AirtestProject/Airtest/blob/21583da2698a601cd632228228fc16d41f60a517/playground/win_ide.py#L53-L78
[ "def", "snapshot", "(", "self", ",", "filename", "=", "\"tmp.png\"", ")", ":", "if", "not", "filename", ":", "filename", "=", "\"tmp.png\"", "if", "self", ".", "handle", ":", "try", ":", "screenshot", "(", "filename", ",", "self", ".", "handle", ")", "...
21583da2698a601cd632228228fc16d41f60a517
train
PlotResult.extract_data
从数据中获取到绘图相关的有用信息.
benchmark/plot.py
def extract_data(self): """从数据中获取到绘图相关的有用信息.""" self.time_axis = [] self.cpu_axis = [] self.mem_axis = [] self.timestamp_list = [] plot_data = self.data.get("plot_data", []) # 按照时间分割线,划分成几段数据,取其中的最值 for i in plot_data: timestamp = i["timestamp"...
def extract_data(self): """从数据中获取到绘图相关的有用信息.""" self.time_axis = [] self.cpu_axis = [] self.mem_axis = [] self.timestamp_list = [] plot_data = self.data.get("plot_data", []) # 按照时间分割线,划分成几段数据,取其中的最值 for i in plot_data: timestamp = i["timestamp"...
[ "从数据中获取到绘图相关的有用信息", "." ]
AirtestProject/Airtest
python
https://github.com/AirtestProject/Airtest/blob/21583da2698a601cd632228228fc16d41f60a517/benchmark/plot.py#L38-L59
[ "def", "extract_data", "(", "self", ")", ":", "self", ".", "time_axis", "=", "[", "]", "self", ".", "cpu_axis", "=", "[", "]", "self", ".", "mem_axis", "=", "[", "]", "self", ".", "timestamp_list", "=", "[", "]", "plot_data", "=", "self", ".", "dat...
21583da2698a601cd632228228fc16d41f60a517
train
PlotResult.get_each_method_maximun_cpu_mem
获取每个方法中的cpu和内存耗费最值点.
benchmark/plot.py
def get_each_method_maximun_cpu_mem(self): """获取每个方法中的cpu和内存耗费最值点.""" # 本函数用于丰富self.method_exec_info的信息:存入cpu、mem最值点 self.method_exec_info = deepcopy(self.data.get("method_exec_info", [])) method_exec_info = deepcopy(self.method_exec_info) # 用来辅助循环 method_index, cpu_max, cpu_max...
def get_each_method_maximun_cpu_mem(self): """获取每个方法中的cpu和内存耗费最值点.""" # 本函数用于丰富self.method_exec_info的信息:存入cpu、mem最值点 self.method_exec_info = deepcopy(self.data.get("method_exec_info", [])) method_exec_info = deepcopy(self.method_exec_info) # 用来辅助循环 method_index, cpu_max, cpu_max...
[ "获取每个方法中的cpu和内存耗费最值点", "." ]
AirtestProject/Airtest
python
https://github.com/AirtestProject/Airtest/blob/21583da2698a601cd632228228fc16d41f60a517/benchmark/plot.py#L61-L95
[ "def", "get_each_method_maximun_cpu_mem", "(", "self", ")", ":", "# 本函数用于丰富self.method_exec_info的信息:存入cpu、mem最值点", "self", ".", "method_exec_info", "=", "deepcopy", "(", "self", ".", "data", ".", "get", "(", "\"method_exec_info\"", ",", "[", "]", ")", ")", "method_e...
21583da2698a601cd632228228fc16d41f60a517
train
PlotResult._get_graph_title
获取图像的title.
benchmark/plot.py
def _get_graph_title(self): """获取图像的title.""" start_time = datetime.fromtimestamp(int(self.timestamp_list[0])) end_time = datetime.fromtimestamp(int(self.timestamp_list[-1])) end_time = end_time.strftime('%H:%M:%S') title = "Timespan: %s —— %s" % (start_time, end_time) r...
def _get_graph_title(self): """获取图像的title.""" start_time = datetime.fromtimestamp(int(self.timestamp_list[0])) end_time = datetime.fromtimestamp(int(self.timestamp_list[-1])) end_time = end_time.strftime('%H:%M:%S') title = "Timespan: %s —— %s" % (start_time, end_time) r...
[ "获取图像的title", "." ]
AirtestProject/Airtest
python
https://github.com/AirtestProject/Airtest/blob/21583da2698a601cd632228228fc16d41f60a517/benchmark/plot.py#L97-L104
[ "def", "_get_graph_title", "(", "self", ")", ":", "start_time", "=", "datetime", ".", "fromtimestamp", "(", "int", "(", "self", ".", "timestamp_list", "[", "0", "]", ")", ")", "end_time", "=", "datetime", ".", "fromtimestamp", "(", "int", "(", "self", "....
21583da2698a601cd632228228fc16d41f60a517
train
PlotResult.plot_cpu_mem_keypoints
绘制CPU/Mem/特征点数量.
benchmark/plot.py
def plot_cpu_mem_keypoints(self): """绘制CPU/Mem/特征点数量.""" plt.figure(1) # 开始绘制子图: plt.subplot(311) title = self._get_graph_title() plt.title(title, loc="center") # 设置绘图的标题 mem_ins = plt.plot(self.time_axis, self.mem_axis, "-", label="Mem(MB)", color='deepskyblue',...
def plot_cpu_mem_keypoints(self): """绘制CPU/Mem/特征点数量.""" plt.figure(1) # 开始绘制子图: plt.subplot(311) title = self._get_graph_title() plt.title(title, loc="center") # 设置绘图的标题 mem_ins = plt.plot(self.time_axis, self.mem_axis, "-", label="Mem(MB)", color='deepskyblue',...
[ "绘制CPU", "/", "Mem", "/", "特征点数量", "." ]
AirtestProject/Airtest
python
https://github.com/AirtestProject/Airtest/blob/21583da2698a601cd632228228fc16d41f60a517/benchmark/plot.py#L106-L172
[ "def", "plot_cpu_mem_keypoints", "(", "self", ")", ":", "plt", ".", "figure", "(", "1", ")", "# 开始绘制子图:", "plt", ".", "subplot", "(", "311", ")", "title", "=", "self", ".", "_get_graph_title", "(", ")", "plt", ".", "title", "(", "title", ",", "loc", ...
21583da2698a601cd632228228fc16d41f60a517
train
CheckKeypointResult.refresh_method_objects
初始化方法对象.
benchmark/profile_recorder.py
def refresh_method_objects(self): """初始化方法对象.""" self.method_object_dict = {} for key, method in self.MATCHING_METHODS.items(): method_object = method(self.im_search, self.im_source, self.threshold, self.rgb) self.method_object_dict.update({key: method_object})
def refresh_method_objects(self): """初始化方法对象.""" self.method_object_dict = {} for key, method in self.MATCHING_METHODS.items(): method_object = method(self.im_search, self.im_source, self.threshold, self.rgb) self.method_object_dict.update({key: method_object})
[ "初始化方法对象", "." ]
AirtestProject/Airtest
python
https://github.com/AirtestProject/Airtest/blob/21583da2698a601cd632228228fc16d41f60a517/benchmark/profile_recorder.py#L44-L49
[ "def", "refresh_method_objects", "(", "self", ")", ":", "self", ".", "method_object_dict", "=", "{", "}", "for", "key", ",", "method", "in", "self", ".", "MATCHING_METHODS", ".", "items", "(", ")", ":", "method_object", "=", "method", "(", "self", ".", "...
21583da2698a601cd632228228fc16d41f60a517
train
CheckKeypointResult._get_result
获取特征点.
benchmark/profile_recorder.py
def _get_result(self, method_name="kaze"): """获取特征点.""" method_object = self.method_object_dict.get(method_name) # 提取结果和特征点: try: result = method_object.find_best_result() except Exception: import traceback traceback.print_exc() ret...
def _get_result(self, method_name="kaze"): """获取特征点.""" method_object = self.method_object_dict.get(method_name) # 提取结果和特征点: try: result = method_object.find_best_result() except Exception: import traceback traceback.print_exc() ret...
[ "获取特征点", "." ]
AirtestProject/Airtest
python
https://github.com/AirtestProject/Airtest/blob/21583da2698a601cd632228228fc16d41f60a517/benchmark/profile_recorder.py#L51-L62
[ "def", "_get_result", "(", "self", ",", "method_name", "=", "\"kaze\"", ")", ":", "method_object", "=", "self", ".", "method_object_dict", ".", "get", "(", "method_name", ")", "# 提取结果和特征点:", "try", ":", "result", "=", "method_object", ".", "find_best_result", ...
21583da2698a601cd632228228fc16d41f60a517
train
CheckKeypointResult.get_and_plot_keypoints
获取并且绘制出特征点匹配结果.
benchmark/profile_recorder.py
def get_and_plot_keypoints(self, method_name, plot=False): """获取并且绘制出特征点匹配结果.""" if method_name not in self.method_object_dict.keys(): print("'%s' is not in MATCHING_METHODS" % method_name) return None kp_sch, kp_src, good, result = self._get_result(method_name) ...
def get_and_plot_keypoints(self, method_name, plot=False): """获取并且绘制出特征点匹配结果.""" if method_name not in self.method_object_dict.keys(): print("'%s' is not in MATCHING_METHODS" % method_name) return None kp_sch, kp_src, good, result = self._get_result(method_name) ...
[ "获取并且绘制出特征点匹配结果", "." ]
AirtestProject/Airtest
python
https://github.com/AirtestProject/Airtest/blob/21583da2698a601cd632228228fc16d41f60a517/benchmark/profile_recorder.py#L64-L100
[ "def", "get_and_plot_keypoints", "(", "self", ",", "method_name", ",", "plot", "=", "False", ")", ":", "if", "method_name", "not", "in", "self", ".", "method_object_dict", ".", "keys", "(", ")", ":", "print", "(", "\"'%s' is not in MATCHING_METHODS\"", "%", "m...
21583da2698a601cd632228228fc16d41f60a517
train
RecordThread.run
开始线程.
benchmark/profile_recorder.py
def run(self): """开始线程.""" while not self.stop_flag: timestamp = time.time() cpu_percent = self.process.cpu_percent() / self.cpu_num # mem_percent = mem = self.process.memory_percent() mem_info = dict(self.process.memory_info()._asdict()) mem_g...
def run(self): """开始线程.""" while not self.stop_flag: timestamp = time.time() cpu_percent = self.process.cpu_percent() / self.cpu_num # mem_percent = mem = self.process.memory_percent() mem_info = dict(self.process.memory_info()._asdict()) mem_g...
[ "开始线程", "." ]
AirtestProject/Airtest
python
https://github.com/AirtestProject/Airtest/blob/21583da2698a601cd632228228fc16d41f60a517/benchmark/profile_recorder.py#L121-L132
[ "def", "run", "(", "self", ")", ":", "while", "not", "self", ".", "stop_flag", ":", "timestamp", "=", "time", ".", "time", "(", ")", "cpu_percent", "=", "self", ".", "process", ".", "cpu_percent", "(", ")", "/", "self", ".", "cpu_num", "# mem_percent =...
21583da2698a601cd632228228fc16d41f60a517
train
ProfileRecorder.load_images
加载待匹配图片.
benchmark/profile_recorder.py
def load_images(self, search_file, source_file): """加载待匹配图片.""" self.search_file, self.source_file = search_file, source_file self.im_search, self.im_source = imread(self.search_file), imread(self.source_file) # 初始化对象 self.check_macthing_object = CheckKeypointResult(self.im_searc...
def load_images(self, search_file, source_file): """加载待匹配图片.""" self.search_file, self.source_file = search_file, source_file self.im_search, self.im_source = imread(self.search_file), imread(self.source_file) # 初始化对象 self.check_macthing_object = CheckKeypointResult(self.im_searc...
[ "加载待匹配图片", "." ]
AirtestProject/Airtest
python
https://github.com/AirtestProject/Airtest/blob/21583da2698a601cd632228228fc16d41f60a517/benchmark/profile_recorder.py#L145-L150
[ "def", "load_images", "(", "self", ",", "search_file", ",", "source_file", ")", ":", "self", ".", "search_file", ",", "self", ".", "source_file", "=", "search_file", ",", "source_file", "self", ".", "im_search", ",", "self", ".", "im_source", "=", "imread", ...
21583da2698a601cd632228228fc16d41f60a517
train
ProfileRecorder.profile_methods
帮助函数执行时记录数据.
benchmark/profile_recorder.py
def profile_methods(self, method_list): """帮助函数执行时记录数据.""" self.method_exec_info = [] # 开始数据记录进程 self.record_thread.stop_flag = False self.record_thread.start() for name in method_list: if name not in self.check_macthing_object.MATCHING_METHODS.keys(): ...
def profile_methods(self, method_list): """帮助函数执行时记录数据.""" self.method_exec_info = [] # 开始数据记录进程 self.record_thread.stop_flag = False self.record_thread.start() for name in method_list: if name not in self.check_macthing_object.MATCHING_METHODS.keys(): ...
[ "帮助函数执行时记录数据", "." ]
AirtestProject/Airtest
python
https://github.com/AirtestProject/Airtest/blob/21583da2698a601cd632228228fc16d41f60a517/benchmark/profile_recorder.py#L152-L180
[ "def", "profile_methods", "(", "self", ",", "method_list", ")", ":", "self", ".", "method_exec_info", "=", "[", "]", "# 开始数据记录进程", "self", ".", "record_thread", ".", "stop_flag", "=", "False", "self", ".", "record_thread", ".", "start", "(", ")", "for", "n...
21583da2698a601cd632228228fc16d41f60a517
train
ProfileRecorder.wite_to_json
将性能数据写入文件.
benchmark/profile_recorder.py
def wite_to_json(self, dir_path="", file_name=""): """将性能数据写入文件.""" # 提取数据 data = { "plot_data": self.record_thread.profile_data, "method_exec_info": self.method_exec_info, "search_file": self.search_file, "source_file": self.source_file} #...
def wite_to_json(self, dir_path="", file_name=""): """将性能数据写入文件.""" # 提取数据 data = { "plot_data": self.record_thread.profile_data, "method_exec_info": self.method_exec_info, "search_file": self.search_file, "source_file": self.source_file} #...
[ "将性能数据写入文件", "." ]
AirtestProject/Airtest
python
https://github.com/AirtestProject/Airtest/blob/21583da2698a601cd632228228fc16d41f60a517/benchmark/profile_recorder.py#L182-L194
[ "def", "wite_to_json", "(", "self", ",", "dir_path", "=", "\"\"", ",", "file_name", "=", "\"\"", ")", ":", "# 提取数据", "data", "=", "{", "\"plot_data\"", ":", "self", ".", "record_thread", ".", "profile_data", ",", "\"method_exec_info\"", ":", "self", ".", "...
21583da2698a601cd632228228fc16d41f60a517
train
PocoReport.translate_poco_step
处理poco的相关操作,参数与airtest的不同,由一个截图和一个操作构成,需要合成一个步骤 Parameters ---------- step 一个完整的操作,如click prev_step 前一个步骤,应该是截图 Returns -------
playground/poco.py
def translate_poco_step(self, step): """ 处理poco的相关操作,参数与airtest的不同,由一个截图和一个操作构成,需要合成一个步骤 Parameters ---------- step 一个完整的操作,如click prev_step 前一个步骤,应该是截图 Returns ------- """ ret = {} prev_step = self._steps[-1] if prev_step...
def translate_poco_step(self, step): """ 处理poco的相关操作,参数与airtest的不同,由一个截图和一个操作构成,需要合成一个步骤 Parameters ---------- step 一个完整的操作,如click prev_step 前一个步骤,应该是截图 Returns ------- """ ret = {} prev_step = self._steps[-1] if prev_step...
[ "处理poco的相关操作,参数与airtest的不同,由一个截图和一个操作构成,需要合成一个步骤", "Parameters", "----------", "step", "一个完整的操作,如click", "prev_step", "前一个步骤,应该是截图" ]
AirtestProject/Airtest
python
https://github.com/AirtestProject/Airtest/blob/21583da2698a601cd632228228fc16d41f60a517/playground/poco.py#L12-L53
[ "def", "translate_poco_step", "(", "self", ",", "step", ")", ":", "ret", "=", "{", "}", "prev_step", "=", "self", ".", "_steps", "[", "-", "1", "]", "if", "prev_step", ":", "ret", ".", "update", "(", "prev_step", ")", "ret", "[", "'type'", "]", "="...
21583da2698a601cd632228228fc16d41f60a517
train
PocoReport.func_desc_poco
把对应的poco操作显示成中文
playground/poco.py
def func_desc_poco(self, step): """ 把对应的poco操作显示成中文""" desc = { "touch": u"点击UI组件 {name}".format(name=step.get("text", "")), } if step['type'] in desc: return desc.get(step['type']) else: return self._translate_desc(step)
def func_desc_poco(self, step): """ 把对应的poco操作显示成中文""" desc = { "touch": u"点击UI组件 {name}".format(name=step.get("text", "")), } if step['type'] in desc: return desc.get(step['type']) else: return self._translate_desc(step)
[ "把对应的poco操作显示成中文" ]
AirtestProject/Airtest
python
https://github.com/AirtestProject/Airtest/blob/21583da2698a601cd632228228fc16d41f60a517/playground/poco.py#L55-L63
[ "def", "func_desc_poco", "(", "self", ",", "step", ")", ":", "desc", "=", "{", "\"touch\"", ":", "u\"点击UI组件 {name}\".format(", "n", "ame=st", "e", "p.ge", "t", "(\"te", "x", "t\",", " ", "\"\")),", "", "", "", "", "", "}", "if", "step", "[", "'type'"...
21583da2698a601cd632228228fc16d41f60a517
train
profile_different_methods
对指定的图片进行性能测试.
benchmark/benchmark.py
def profile_different_methods(search_file, screen_file, method_list, dir_path, file_name): """对指定的图片进行性能测试.""" profiler = ProfileRecorder(0.05) # 加载图片 profiler.load_images(search_file, screen_file) # 传入待测试的方法列表 profiler.profile_methods(method_list) # 将性能数据写入文件 profiler.wite_to_json(dir_p...
def profile_different_methods(search_file, screen_file, method_list, dir_path, file_name): """对指定的图片进行性能测试.""" profiler = ProfileRecorder(0.05) # 加载图片 profiler.load_images(search_file, screen_file) # 传入待测试的方法列表 profiler.profile_methods(method_list) # 将性能数据写入文件 profiler.wite_to_json(dir_p...
[ "对指定的图片进行性能测试", "." ]
AirtestProject/Airtest
python
https://github.com/AirtestProject/Airtest/blob/21583da2698a601cd632228228fc16d41f60a517/benchmark/benchmark.py#L12-L20
[ "def", "profile_different_methods", "(", "search_file", ",", "screen_file", ",", "method_list", ",", "dir_path", ",", "file_name", ")", ":", "profiler", "=", "ProfileRecorder", "(", "0.05", ")", "# 加载图片", "profiler", ".", "load_images", "(", "search_file", ",", ...
21583da2698a601cd632228228fc16d41f60a517
train
plot_profiled_all_images_table
绘制多个图片的结果.
benchmark/benchmark.py
def plot_profiled_all_images_table(method_list): """绘制多个图片的结果.""" high_dpi_dir_path, high_dpi_file_name = "result", "high_dpi.json" rich_texture_dir_path, rich_texture_file_name = "result", "rich_texture.json" text_dir_path, text_file_name = "result", "text.json" image_list = ['high_dpi', 'rich_tex...
def plot_profiled_all_images_table(method_list): """绘制多个图片的结果.""" high_dpi_dir_path, high_dpi_file_name = "result", "high_dpi.json" rich_texture_dir_path, rich_texture_file_name = "result", "rich_texture.json" text_dir_path, text_file_name = "result", "text.json" image_list = ['high_dpi', 'rich_tex...
[ "绘制多个图片的结果", "." ]
AirtestProject/Airtest
python
https://github.com/AirtestProject/Airtest/blob/21583da2698a601cd632228228fc16d41f60a517/benchmark/benchmark.py#L53-L99
[ "def", "plot_profiled_all_images_table", "(", "method_list", ")", ":", "high_dpi_dir_path", ",", "high_dpi_file_name", "=", "\"result\"", ",", "\"high_dpi.json\"", "rich_texture_dir_path", ",", "rich_texture_file_name", "=", "\"result\"", ",", "\"rich_texture.json\"", "text_d...
21583da2698a601cd632228228fc16d41f60a517
train
get_color_list
获取method对应的color列表.
benchmark/benchmark.py
def get_color_list(method_list): """获取method对应的color列表.""" color_list = [] for method in method_list: color = tuple([random() for _ in range(3)]) # 随机颜色画线 color_list.append(color) return color_list
def get_color_list(method_list): """获取method对应的color列表.""" color_list = [] for method in method_list: color = tuple([random() for _ in range(3)]) # 随机颜色画线 color_list.append(color) return color_list
[ "获取method对应的color列表", "." ]
AirtestProject/Airtest
python
https://github.com/AirtestProject/Airtest/blob/21583da2698a601cd632228228fc16d41f60a517/benchmark/benchmark.py#L102-L108
[ "def", "get_color_list", "(", "method_list", ")", ":", "color_list", "=", "[", "]", "for", "method", "in", "method_list", ":", "color", "=", "tuple", "(", "[", "random", "(", ")", "for", "_", "in", "range", "(", "3", ")", "]", ")", "# 随机颜色画线", "color...
21583da2698a601cd632228228fc16d41f60a517
train
plot_compare_table
绘制了对比表格.
benchmark/benchmark.py
def plot_compare_table(image_list, method_list, color_list, compare_dict, fig_name="", fig_num=111): """绘制了对比表格.""" row_labels = image_list # 写入值: table_vals = [] for i in range(len(row_labels)): row_vals = [] for method in method_list: row_vals.append(compare_dict[method...
def plot_compare_table(image_list, method_list, color_list, compare_dict, fig_name="", fig_num=111): """绘制了对比表格.""" row_labels = image_list # 写入值: table_vals = [] for i in range(len(row_labels)): row_vals = [] for method in method_list: row_vals.append(compare_dict[method...
[ "绘制了对比表格", "." ]
AirtestProject/Airtest
python
https://github.com/AirtestProject/Airtest/blob/21583da2698a601cd632228228fc16d41f60a517/benchmark/benchmark.py#L111-L136
[ "def", "plot_compare_table", "(", "image_list", ",", "method_list", ",", "color_list", ",", "compare_dict", ",", "fig_name", "=", "\"\"", ",", "fig_num", "=", "111", ")", ":", "row_labels", "=", "image_list", "# 写入值:", "table_vals", "=", "[", "]", "for", "i"...
21583da2698a601cd632228228fc16d41f60a517
train
plot_compare_curves
绘制对比曲线.
benchmark/benchmark.py
def plot_compare_curves(image_list, method_list, color_list, compare_dict, fig_name="", fig_num=111): """绘制对比曲线.""" plt.subplot(fig_num) plt.title(fig_name, loc="center") # 设置绘图的标题 mix_ins = [] for index, method in enumerate(method_list): mem_ins = plt.plot(image_list, compare_dict[method],...
def plot_compare_curves(image_list, method_list, color_list, compare_dict, fig_name="", fig_num=111): """绘制对比曲线.""" plt.subplot(fig_num) plt.title(fig_name, loc="center") # 设置绘图的标题 mix_ins = [] for index, method in enumerate(method_list): mem_ins = plt.plot(image_list, compare_dict[method],...
[ "绘制对比曲线", "." ]
AirtestProject/Airtest
python
https://github.com/AirtestProject/Airtest/blob/21583da2698a601cd632228228fc16d41f60a517/benchmark/benchmark.py#L139-L153
[ "def", "plot_compare_curves", "(", "image_list", ",", "method_list", ",", "color_list", ",", "compare_dict", ",", "fig_name", "=", "\"\"", ",", "fig_num", "=", "111", ")", ":", "plt", ".", "subplot", "(", "fig_num", ")", "plt", ".", "title", "(", "fig_name...
21583da2698a601cd632228228fc16d41f60a517
train
ReadTag
Read a tag from the buffer, and return a (tag_bytes, new_pos) tuple. We return the raw bytes of the tag rather than decoding them. The raw bytes can then be used to look up the proper decoder. This effectively allows us to trade some work that would be done in pure-python (decoding a varint) for work that is...
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py
def ReadTag(buffer, pos): """Read a tag from the buffer, and return a (tag_bytes, new_pos) tuple. We return the raw bytes of the tag rather than decoding them. The raw bytes can then be used to look up the proper decoder. This effectively allows us to trade some work that would be done in pure-python (decodi...
def ReadTag(buffer, pos): """Read a tag from the buffer, and return a (tag_bytes, new_pos) tuple. We return the raw bytes of the tag rather than decoding them. The raw bytes can then be used to look up the proper decoder. This effectively allows us to trade some work that would be done in pure-python (decodi...
[ "Read", "a", "tag", "from", "the", "buffer", "and", "return", "a", "(", "tag_bytes", "new_pos", ")", "tuple", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py#L169-L184
[ "def", "ReadTag", "(", "buffer", ",", "pos", ")", ":", "start", "=", "pos", "while", "six", ".", "indexbytes", "(", "buffer", ",", "pos", ")", "&", "0x80", ":", "pos", "+=", "1", "pos", "+=", "1", "return", "(", "buffer", "[", "start", ":", "pos"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_SimpleDecoder
Return a constructor for a decoder for fields of a particular type. Args: wire_type: The field's wire type. decode_value: A function which decodes an individual value, e.g. _DecodeVarint()
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py
def _SimpleDecoder(wire_type, decode_value): """Return a constructor for a decoder for fields of a particular type. Args: wire_type: The field's wire type. decode_value: A function which decodes an individual value, e.g. _DecodeVarint() """ def SpecificDecoder(field_number, is_repeated, ...
def _SimpleDecoder(wire_type, decode_value): """Return a constructor for a decoder for fields of a particular type. Args: wire_type: The field's wire type. decode_value: A function which decodes an individual value, e.g. _DecodeVarint() """ def SpecificDecoder(field_number, is_repeated, ...
[ "Return", "a", "constructor", "for", "a", "decoder", "for", "fields", "of", "a", "particular", "type", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py#L190-L246
[ "def", "_SimpleDecoder", "(", "wire_type", ",", "decode_value", ")", ":", "def", "SpecificDecoder", "(", "field_number", ",", "is_repeated", ",", "is_packed", ",", "key", ",", "new_default", ")", ":", "if", "is_packed", ":", "local_DecodeVarint", "=", "_DecodeVa...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_ModifiedDecoder
Like SimpleDecoder but additionally invokes modify_value on every value before storing it. Usually modify_value is ZigZagDecode.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py
def _ModifiedDecoder(wire_type, decode_value, modify_value): """Like SimpleDecoder but additionally invokes modify_value on every value before storing it. Usually modify_value is ZigZagDecode. """ # Reusing _SimpleDecoder is slightly slower than copying a bunch of code, but # not enough to make a significan...
def _ModifiedDecoder(wire_type, decode_value, modify_value): """Like SimpleDecoder but additionally invokes modify_value on every value before storing it. Usually modify_value is ZigZagDecode. """ # Reusing _SimpleDecoder is slightly slower than copying a bunch of code, but # not enough to make a significan...
[ "Like", "SimpleDecoder", "but", "additionally", "invokes", "modify_value", "on", "every", "value", "before", "storing", "it", ".", "Usually", "modify_value", "is", "ZigZagDecode", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py#L249-L260
[ "def", "_ModifiedDecoder", "(", "wire_type", ",", "decode_value", ",", "modify_value", ")", ":", "# Reusing _SimpleDecoder is slightly slower than copying a bunch of code, but", "# not enough to make a significant difference.", "def", "InnerDecode", "(", "buffer", ",", "pos", ")"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_StructPackDecoder
Return a constructor for a decoder for a fixed-width field. Args: wire_type: The field's wire type. format: The format string to pass to struct.unpack().
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py
def _StructPackDecoder(wire_type, format): """Return a constructor for a decoder for a fixed-width field. Args: wire_type: The field's wire type. format: The format string to pass to struct.unpack(). """ value_size = struct.calcsize(format) local_unpack = struct.unpack # Reusing _SimpleDeco...
def _StructPackDecoder(wire_type, format): """Return a constructor for a decoder for a fixed-width field. Args: wire_type: The field's wire type. format: The format string to pass to struct.unpack(). """ value_size = struct.calcsize(format) local_unpack = struct.unpack # Reusing _SimpleDeco...
[ "Return", "a", "constructor", "for", "a", "decoder", "for", "a", "fixed", "-", "width", "field", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py#L263-L285
[ "def", "_StructPackDecoder", "(", "wire_type", ",", "format", ")", ":", "value_size", "=", "struct", ".", "calcsize", "(", "format", ")", "local_unpack", "=", "struct", ".", "unpack", "# Reusing _SimpleDecoder is slightly slower than copying a bunch of code, but", "# not ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_FloatDecoder
Returns a decoder for a float field. This code works around a bug in struct.unpack for non-finite 32-bit floating-point values.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py
def _FloatDecoder(): """Returns a decoder for a float field. This code works around a bug in struct.unpack for non-finite 32-bit floating-point values. """ local_unpack = struct.unpack def InnerDecode(buffer, pos): # We expect a 32-bit value in little-endian byte order. Bit 1 is the sign # bit, ...
def _FloatDecoder(): """Returns a decoder for a float field. This code works around a bug in struct.unpack for non-finite 32-bit floating-point values. """ local_unpack = struct.unpack def InnerDecode(buffer, pos): # We expect a 32-bit value in little-endian byte order. Bit 1 is the sign # bit, ...
[ "Returns", "a", "decoder", "for", "a", "float", "field", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py#L288-L320
[ "def", "_FloatDecoder", "(", ")", ":", "local_unpack", "=", "struct", ".", "unpack", "def", "InnerDecode", "(", "buffer", ",", "pos", ")", ":", "# We expect a 32-bit value in little-endian byte order. Bit 1 is the sign", "# bit, bits 2-9 represent the exponent, and bits 10-32 ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_DoubleDecoder
Returns a decoder for a double field. This code works around a bug in struct.unpack for not-a-number.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py
def _DoubleDecoder(): """Returns a decoder for a double field. This code works around a bug in struct.unpack for not-a-number. """ local_unpack = struct.unpack def InnerDecode(buffer, pos): # We expect a 64-bit value in little-endian byte order. Bit 1 is the sign # bit, bits 2-12 represent the exp...
def _DoubleDecoder(): """Returns a decoder for a double field. This code works around a bug in struct.unpack for not-a-number. """ local_unpack = struct.unpack def InnerDecode(buffer, pos): # We expect a 64-bit value in little-endian byte order. Bit 1 is the sign # bit, bits 2-12 represent the exp...
[ "Returns", "a", "decoder", "for", "a", "double", "field", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py#L323-L350
[ "def", "_DoubleDecoder", "(", ")", ":", "local_unpack", "=", "struct", ".", "unpack", "def", "InnerDecode", "(", "buffer", ",", "pos", ")", ":", "# We expect a 64-bit value in little-endian byte order. Bit 1 is the sign", "# bit, bits 2-12 represent the exponent, and bits 13-6...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
StringDecoder
Returns a decoder for a string field.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py
def StringDecoder(field_number, is_repeated, is_packed, key, new_default): """Returns a decoder for a string field.""" local_DecodeVarint = _DecodeVarint local_unicode = six.text_type def _ConvertToUnicode(byte_str): try: return local_unicode(byte_str, 'utf-8') except UnicodeDecodeError as e: ...
def StringDecoder(field_number, is_repeated, is_packed, key, new_default): """Returns a decoder for a string field.""" local_DecodeVarint = _DecodeVarint local_unicode = six.text_type def _ConvertToUnicode(byte_str): try: return local_unicode(byte_str, 'utf-8') except UnicodeDecodeError as e: ...
[ "Returns", "a", "decoder", "for", "a", "string", "field", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py#L461-L504
[ "def", "StringDecoder", "(", "field_number", ",", "is_repeated", ",", "is_packed", ",", "key", ",", "new_default", ")", ":", "local_DecodeVarint", "=", "_DecodeVarint", "local_unicode", "=", "six", ".", "text_type", "def", "_ConvertToUnicode", "(", "byte_str", ")"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
BytesDecoder
Returns a decoder for a bytes field.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py
def BytesDecoder(field_number, is_repeated, is_packed, key, new_default): """Returns a decoder for a bytes field.""" local_DecodeVarint = _DecodeVarint assert not is_packed if is_repeated: tag_bytes = encoder.TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED) ...
def BytesDecoder(field_number, is_repeated, is_packed, key, new_default): """Returns a decoder for a bytes field.""" local_DecodeVarint = _DecodeVarint assert not is_packed if is_repeated: tag_bytes = encoder.TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED) ...
[ "Returns", "a", "decoder", "for", "a", "bytes", "field", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py#L507-L541
[ "def", "BytesDecoder", "(", "field_number", ",", "is_repeated", ",", "is_packed", ",", "key", ",", "new_default", ")", ":", "local_DecodeVarint", "=", "_DecodeVarint", "assert", "not", "is_packed", "if", "is_repeated", ":", "tag_bytes", "=", "encoder", ".", "Tag...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
GroupDecoder
Returns a decoder for a group field.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py
def GroupDecoder(field_number, is_repeated, is_packed, key, new_default): """Returns a decoder for a group field.""" end_tag_bytes = encoder.TagBytes(field_number, wire_format.WIRETYPE_END_GROUP) end_tag_len = len(end_tag_bytes) assert not is_packed if is_repeated: tag...
def GroupDecoder(field_number, is_repeated, is_packed, key, new_default): """Returns a decoder for a group field.""" end_tag_bytes = encoder.TagBytes(field_number, wire_format.WIRETYPE_END_GROUP) end_tag_len = len(end_tag_bytes) assert not is_packed if is_repeated: tag...
[ "Returns", "a", "decoder", "for", "a", "group", "field", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py#L544-L588
[ "def", "GroupDecoder", "(", "field_number", ",", "is_repeated", ",", "is_packed", ",", "key", ",", "new_default", ")", ":", "end_tag_bytes", "=", "encoder", ".", "TagBytes", "(", "field_number", ",", "wire_format", ".", "WIRETYPE_END_GROUP", ")", "end_tag_len", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
MapDecoder
Returns a decoder for a map field.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py
def MapDecoder(field_descriptor, new_default, is_message_map): """Returns a decoder for a map field.""" key = field_descriptor tag_bytes = encoder.TagBytes(field_descriptor.number, wire_format.WIRETYPE_LENGTH_DELIMITED) tag_len = len(tag_bytes) local_DecodeVarint = _DecodeVarin...
def MapDecoder(field_descriptor, new_default, is_message_map): """Returns a decoder for a map field.""" key = field_descriptor tag_bytes = encoder.TagBytes(field_descriptor.number, wire_format.WIRETYPE_LENGTH_DELIMITED) tag_len = len(tag_bytes) local_DecodeVarint = _DecodeVarin...
[ "Returns", "a", "decoder", "for", "a", "map", "field", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py#L719-L759
[ "def", "MapDecoder", "(", "field_descriptor", ",", "new_default", ",", "is_message_map", ")", ":", "key", "=", "field_descriptor", "tag_bytes", "=", "encoder", ".", "TagBytes", "(", "field_descriptor", ".", "number", ",", "wire_format", ".", "WIRETYPE_LENGTH_DELIMIT...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_SkipVarint
Skip a varint value. Returns the new position.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py
def _SkipVarint(buffer, pos, end): """Skip a varint value. Returns the new position.""" # Previously ord(buffer[pos]) raised IndexError when pos is out of range. # With this code, ord(b'') raises TypeError. Both are handled in # python_message.py to generate a 'Truncated message' error. while ord(buffer[pos...
def _SkipVarint(buffer, pos, end): """Skip a varint value. Returns the new position.""" # Previously ord(buffer[pos]) raised IndexError when pos is out of range. # With this code, ord(b'') raises TypeError. Both are handled in # python_message.py to generate a 'Truncated message' error. while ord(buffer[pos...
[ "Skip", "a", "varint", "value", ".", "Returns", "the", "new", "position", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py#L765-L775
[ "def", "_SkipVarint", "(", "buffer", ",", "pos", ",", "end", ")", ":", "# Previously ord(buffer[pos]) raised IndexError when pos is out of range.", "# With this code, ord(b'') raises TypeError. Both are handled in", "# python_message.py to generate a 'Truncated message' error.", "while", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_SkipLengthDelimited
Skip a length-delimited value. Returns the new position.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py
def _SkipLengthDelimited(buffer, pos, end): """Skip a length-delimited value. Returns the new position.""" (size, pos) = _DecodeVarint(buffer, pos) pos += size if pos > end: raise _DecodeError('Truncated message.') return pos
def _SkipLengthDelimited(buffer, pos, end): """Skip a length-delimited value. Returns the new position.""" (size, pos) = _DecodeVarint(buffer, pos) pos += size if pos > end: raise _DecodeError('Truncated message.') return pos
[ "Skip", "a", "length", "-", "delimited", "value", ".", "Returns", "the", "new", "position", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py#L785-L792
[ "def", "_SkipLengthDelimited", "(", "buffer", ",", "pos", ",", "end", ")", ":", "(", "size", ",", "pos", ")", "=", "_DecodeVarint", "(", "buffer", ",", "pos", ")", "pos", "+=", "size", "if", "pos", ">", "end", ":", "raise", "_DecodeError", "(", "'Tru...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_SkipGroup
Skip sub-group. Returns the new position.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py
def _SkipGroup(buffer, pos, end): """Skip sub-group. Returns the new position.""" while 1: (tag_bytes, pos) = ReadTag(buffer, pos) new_pos = SkipField(buffer, pos, end, tag_bytes) if new_pos == -1: return pos pos = new_pos
def _SkipGroup(buffer, pos, end): """Skip sub-group. Returns the new position.""" while 1: (tag_bytes, pos) = ReadTag(buffer, pos) new_pos = SkipField(buffer, pos, end, tag_bytes) if new_pos == -1: return pos pos = new_pos
[ "Skip", "sub", "-", "group", ".", "Returns", "the", "new", "position", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py#L794-L802
[ "def", "_SkipGroup", "(", "buffer", ",", "pos", ",", "end", ")", ":", "while", "1", ":", "(", "tag_bytes", ",", "pos", ")", "=", "ReadTag", "(", "buffer", ",", "pos", ")", "new_pos", "=", "SkipField", "(", "buffer", ",", "pos", ",", "end", ",", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_FieldSkipper
Constructs the SkipField function.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py
def _FieldSkipper(): """Constructs the SkipField function.""" WIRETYPE_TO_SKIPPER = [ _SkipVarint, _SkipFixed64, _SkipLengthDelimited, _SkipGroup, _EndGroup, _SkipFixed32, _RaiseInvalidWireType, _RaiseInvalidWireType, ] wiretype_mask = wire_format.TAG_TYPE_M...
def _FieldSkipper(): """Constructs the SkipField function.""" WIRETYPE_TO_SKIPPER = [ _SkipVarint, _SkipFixed64, _SkipLengthDelimited, _SkipGroup, _EndGroup, _SkipFixed32, _RaiseInvalidWireType, _RaiseInvalidWireType, ] wiretype_mask = wire_format.TAG_TYPE_M...
[ "Constructs", "the", "SkipField", "function", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/decoder.py#L822-L852
[ "def", "_FieldSkipper", "(", ")", ":", "WIRETYPE_TO_SKIPPER", "=", "[", "_SkipVarint", ",", "_SkipFixed64", ",", "_SkipLengthDelimited", ",", "_SkipGroup", ",", "_EndGroup", ",", "_SkipFixed32", ",", "_RaiseInvalidWireType", ",", "_RaiseInvalidWireType", ",", "]", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_parse_node
parse dumped node
src/external/xgboost/python-package/xgboost/plotting.py
def _parse_node(graph, text): """parse dumped node""" match = _NODEPAT.match(text) if match is not None: node = match.group(1) graph.node(node, label=match.group(2), shape='circle') return node match = _LEAFPAT.match(text) if match is not None: node = match.group(1) ...
def _parse_node(graph, text): """parse dumped node""" match = _NODEPAT.match(text) if match is not None: node = match.group(1) graph.node(node, label=match.group(2), shape='circle') return node match = _LEAFPAT.match(text) if match is not None: node = match.group(1) ...
[ "parse", "dumped", "node" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/plotting.py#L109-L121
[ "def", "_parse_node", "(", "graph", ",", "text", ")", ":", "match", "=", "_NODEPAT", ".", "match", "(", "text", ")", "if", "match", "is", "not", "None", ":", "node", "=", "match", ".", "group", "(", "1", ")", "graph", ".", "node", "(", "node", ",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
plot_tree
Plot specified tree. Parameters ---------- booster : Booster, XGBModel Booster or XGBModel instance num_trees : int, default 0 Specify the ordinal number of target tree rankdir : str, default "UT" Passed to graphiz via graph_attr ax : matplotlib Axes, default None ...
src/external/xgboost/python-package/xgboost/plotting.py
def plot_tree(booster, num_trees=0, rankdir='UT', ax=None, **kwargs): """Plot specified tree. Parameters ---------- booster : Booster, XGBModel Booster or XGBModel instance num_trees : int, default 0 Specify the ordinal number of target tree rankdir : str, default "UT" P...
def plot_tree(booster, num_trees=0, rankdir='UT', ax=None, **kwargs): """Plot specified tree. Parameters ---------- booster : Booster, XGBModel Booster or XGBModel instance num_trees : int, default 0 Specify the ordinal number of target tree rankdir : str, default "UT" P...
[ "Plot", "specified", "tree", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/plotting.py#L206-L246
[ "def", "plot_tree", "(", "booster", ",", "num_trees", "=", "0", ",", "rankdir", "=", "'UT'", ",", "ax", "=", "None", ",", "*", "*", "kwargs", ")", ":", "try", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "import", "matplotlib", ".", "imag...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Manager.construct
Constructs the dependency graph. properties: the build properties. targets: the targets to consider. If none is specified, uses all.
deps/src/boost_1_68_0/tools/build/src/manager.py
def construct (self, properties = [], targets = []): """ Constructs the dependency graph. properties: the build properties. targets: the targets to consider. If none is specified, uses all. """ if not targets: for name, project in self.projects ().project...
def construct (self, properties = [], targets = []): """ Constructs the dependency graph. properties: the build properties. targets: the targets to consider. If none is specified, uses all. """ if not targets: for name, project in self.projects ().project...
[ "Constructs", "the", "dependency", "graph", ".", "properties", ":", "the", "build", "properties", ".", "targets", ":", "the", "targets", "to", "consider", ".", "If", "none", "is", "specified", "uses", "all", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/manager.py#L83-L109
[ "def", "construct", "(", "self", ",", "properties", "=", "[", "]", ",", "targets", "=", "[", "]", ")", ":", "if", "not", "targets", ":", "for", "name", ",", "project", "in", "self", ".", "projects", "(", ")", ".", "projects", "(", ")", ":", "targ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DecisionTreeClassifier.evaluate
Evaluate the model by making predictions of target values and comparing these to actual values. Parameters ---------- dataset : SFrame Dataset of new observations. Must include columns with the same names as the target and features used for model training. Additi...
src/unity/python/turicreate/toolkits/classifier/decision_tree_classifier.py
def evaluate(self, dataset, metric='auto', missing_value_action='auto'): """ Evaluate the model by making predictions of target values and comparing these to actual values. Parameters ---------- dataset : SFrame Dataset of new observations. Must include colum...
def evaluate(self, dataset, metric='auto', missing_value_action='auto'): """ Evaluate the model by making predictions of target values and comparing these to actual values. Parameters ---------- dataset : SFrame Dataset of new observations. Must include colum...
[ "Evaluate", "the", "model", "by", "making", "predictions", "of", "target", "values", "and", "comparing", "these", "to", "actual", "values", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/decision_tree_classifier.py#L143-L208
[ "def", "evaluate", "(", "self", ",", "dataset", ",", "metric", "=", "'auto'", ",", "missing_value_action", "=", "'auto'", ")", ":", "_raise_error_evaluation_metric_is_valid", "(", "metric", ",", "[", "'auto'", ",", "'accuracy'", ",", "'confusion_matrix'", ",", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DecisionTreeClassifier.predict
A flexible and advanced prediction API. The target column is provided during :func:`~turicreate.decision_tree.create`. If the target column is in the `dataset` it will be ignored. Parameters ---------- dataset : SFrame A dataset that has the same columns that ...
src/unity/python/turicreate/toolkits/classifier/decision_tree_classifier.py
def predict(self, dataset, output_type='class', missing_value_action='auto'): """ A flexible and advanced prediction API. The target column is provided during :func:`~turicreate.decision_tree.create`. If the target column is in the `dataset` it will be ignored. Paramete...
def predict(self, dataset, output_type='class', missing_value_action='auto'): """ A flexible and advanced prediction API. The target column is provided during :func:`~turicreate.decision_tree.create`. If the target column is in the `dataset` it will be ignored. Paramete...
[ "A", "flexible", "and", "advanced", "prediction", "API", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/decision_tree_classifier.py#L210-L271
[ "def", "predict", "(", "self", ",", "dataset", ",", "output_type", "=", "'class'", ",", "missing_value_action", "=", "'auto'", ")", ":", "_check_categorical_option_type", "(", "'output_type'", ",", "output_type", ",", "[", "'class'", ",", "'margin'", ",", "'prob...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DecisionTreeClassifier.predict_topk
Return top-k predictions for the ``dataset``, using the trained model. Predictions are returned as an SFrame with three columns: `id`, `class`, and `probability`, `margin`, or `rank`, depending on the ``output_type`` parameter. Input dataset size must be the same as for training of the model. ...
src/unity/python/turicreate/toolkits/classifier/decision_tree_classifier.py
def predict_topk(self, dataset, output_type="probability", k=3, missing_value_action='auto'): """ Return top-k predictions for the ``dataset``, using the trained model. Predictions are returned as an SFrame with three columns: `id`, `class`, and `probability`, `margin`, or `rank`, depen...
def predict_topk(self, dataset, output_type="probability", k=3, missing_value_action='auto'): """ Return top-k predictions for the ``dataset``, using the trained model. Predictions are returned as an SFrame with three columns: `id`, `class`, and `probability`, `margin`, or `rank`, depen...
[ "Return", "top", "-", "k", "predictions", "for", "the", "dataset", "using", "the", "trained", "model", ".", "Predictions", "are", "returned", "as", "an", "SFrame", "with", "three", "columns", ":", "id", "class", "and", "probability", "margin", "or", "rank", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/decision_tree_classifier.py#L273-L353
[ "def", "predict_topk", "(", "self", ",", "dataset", ",", "output_type", "=", "\"probability\"", ",", "k", "=", "3", ",", "missing_value_action", "=", "'auto'", ")", ":", "_check_categorical_option_type", "(", "'output_type'", ",", "output_type", ",", "[", "'rank...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DecisionTreeClassifier.classify
Return a classification, for each example in the ``dataset``, using the trained model. The output SFrame contains predictions as class labels (0 or 1) and probabilities associated with the the example. Parameters ---------- dataset : SFrame Dataset of new observation...
src/unity/python/turicreate/toolkits/classifier/decision_tree_classifier.py
def classify(self, dataset, missing_value_action='auto'): """ Return a classification, for each example in the ``dataset``, using the trained model. The output SFrame contains predictions as class labels (0 or 1) and probabilities associated with the the example. Parameters ...
def classify(self, dataset, missing_value_action='auto'): """ Return a classification, for each example in the ``dataset``, using the trained model. The output SFrame contains predictions as class labels (0 or 1) and probabilities associated with the the example. Parameters ...
[ "Return", "a", "classification", "for", "each", "example", "in", "the", "dataset", "using", "the", "trained", "model", ".", "The", "output", "SFrame", "contains", "predictions", "as", "class", "labels", "(", "0", "or", "1", ")", "and", "probabilities", "asso...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/decision_tree_classifier.py#L355-L403
[ "def", "classify", "(", "self", ",", "dataset", ",", "missing_value_action", "=", "'auto'", ")", ":", "return", "super", "(", "DecisionTreeClassifier", ",", "self", ")", ".", "classify", "(", "dataset", ",", "missing_value_action", "=", "missing_value_action", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Tracker.slave_envs
get enviroment variables for slaves can be passed in as args or envs
src/external/xgboost/subtree/rabit/tracker/rabit_tracker.py
def slave_envs(self): """ get enviroment variables for slaves can be passed in as args or envs """ if self.hostIP == 'dns': host = socket.gethostname() elif self.hostIP == 'ip': host = socket.gethostbyname(socket.getfqdn()) else: ...
def slave_envs(self): """ get enviroment variables for slaves can be passed in as args or envs """ if self.hostIP == 'dns': host = socket.gethostname() elif self.hostIP == 'ip': host = socket.gethostbyname(socket.getfqdn()) else: ...
[ "get", "enviroment", "variables", "for", "slaves", "can", "be", "passed", "in", "as", "args", "or", "envs" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/tracker/rabit_tracker.py#L144-L156
[ "def", "slave_envs", "(", "self", ")", ":", "if", "self", ".", "hostIP", "==", "'dns'", ":", "host", "=", "socket", ".", "gethostname", "(", ")", "elif", "self", ".", "hostIP", "==", "'ip'", ":", "host", "=", "socket", ".", "gethostbyname", "(", "soc...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Tracker.find_share_ring
get a ring structure that tends to share nodes with the tree return a list starting from r
src/external/xgboost/subtree/rabit/tracker/rabit_tracker.py
def find_share_ring(self, tree_map, parent_map, r): """ get a ring structure that tends to share nodes with the tree return a list starting from r """ nset = set(tree_map[r]) cset = nset - set([parent_map[r]]) if len(cset) == 0: return [r] rlst...
def find_share_ring(self, tree_map, parent_map, r): """ get a ring structure that tends to share nodes with the tree return a list starting from r """ nset = set(tree_map[r]) cset = nset - set([parent_map[r]]) if len(cset) == 0: return [r] rlst...
[ "get", "a", "ring", "structure", "that", "tends", "to", "share", "nodes", "with", "the", "tree", "return", "a", "list", "starting", "from", "r" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/tracker/rabit_tracker.py#L174-L191
[ "def", "find_share_ring", "(", "self", ",", "tree_map", ",", "parent_map", ",", "r", ")", ":", "nset", "=", "set", "(", "tree_map", "[", "r", "]", ")", "cset", "=", "nset", "-", "set", "(", "[", "parent_map", "[", "r", "]", "]", ")", "if", "len",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Tracker.get_ring
get a ring connection used to recover local data
src/external/xgboost/subtree/rabit/tracker/rabit_tracker.py
def get_ring(self, tree_map, parent_map): """ get a ring connection used to recover local data """ assert parent_map[0] == -1 rlst = self.find_share_ring(tree_map, parent_map, 0) assert len(rlst) == len(tree_map) ring_map = {} nslave = len(tree_map) ...
def get_ring(self, tree_map, parent_map): """ get a ring connection used to recover local data """ assert parent_map[0] == -1 rlst = self.find_share_ring(tree_map, parent_map, 0) assert len(rlst) == len(tree_map) ring_map = {} nslave = len(tree_map) ...
[ "get", "a", "ring", "connection", "used", "to", "recover", "local", "data" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/tracker/rabit_tracker.py#L193-L206
[ "def", "get_ring", "(", "self", ",", "tree_map", ",", "parent_map", ")", ":", "assert", "parent_map", "[", "0", "]", "==", "-", "1", "rlst", "=", "self", ".", "find_share_ring", "(", "tree_map", ",", "parent_map", ",", "0", ")", "assert", "len", "(", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Tracker.get_link_map
get the link map, this is a bit hacky, call for better algorithm to place similar nodes together
src/external/xgboost/subtree/rabit/tracker/rabit_tracker.py
def get_link_map(self, nslave): """ get the link map, this is a bit hacky, call for better algorithm to place similar nodes together """ tree_map, parent_map = self.get_tree(nslave) ring_map = self.get_ring(tree_map, parent_map) rmap = {0 : 0} k = 0 ...
def get_link_map(self, nslave): """ get the link map, this is a bit hacky, call for better algorithm to place similar nodes together """ tree_map, parent_map = self.get_tree(nslave) ring_map = self.get_ring(tree_map, parent_map) rmap = {0 : 0} k = 0 ...
[ "get", "the", "link", "map", "this", "is", "a", "bit", "hacky", "call", "for", "better", "algorithm", "to", "place", "similar", "nodes", "together" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/tracker/rabit_tracker.py#L208-L233
[ "def", "get_link_map", "(", "self", ",", "nslave", ")", ":", "tree_map", ",", "parent_map", "=", "self", ".", "get_tree", "(", "nslave", ")", "ring_map", "=", "self", ".", "get_ring", "(", "tree_map", ",", "parent_map", ")", "rmap", "=", "{", "0", ":",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
maybe_rewrite_setup
Helper rule to generate a faster alternative to MSVC setup scripts. We used to call MSVC setup scripts directly in every action, however in newer MSVC versions (10.0+) they make long-lasting registry queries which have a significant impact on build time.
deps/src/boost_1_68_0/tools/build/src/tools/msvc.py
def maybe_rewrite_setup(toolset, setup_script, setup_options, version, rewrite_setup='off'): """ Helper rule to generate a faster alternative to MSVC setup scripts. We used to call MSVC setup scripts directly in every action, however in newer MSVC versions (10.0+) they make long-lasting registry querie...
def maybe_rewrite_setup(toolset, setup_script, setup_options, version, rewrite_setup='off'): """ Helper rule to generate a faster alternative to MSVC setup scripts. We used to call MSVC setup scripts directly in every action, however in newer MSVC versions (10.0+) they make long-lasting registry querie...
[ "Helper", "rule", "to", "generate", "a", "faster", "alternative", "to", "MSVC", "setup", "scripts", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/msvc.py#L626-L682
[ "def", "maybe_rewrite_setup", "(", "toolset", ",", "setup_script", ",", "setup_options", ",", "version", ",", "rewrite_setup", "=", "'off'", ")", ":", "result", "=", "'\"{}\" {}'", ".", "format", "(", "setup_script", ",", "setup_options", ")", "# At the moment we ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create
Automatically create a suitable classifier model based on the provided training data. To use specific options of a desired model, use the ``create`` function of the corresponding model. Parameters ---------- dataset : SFrame Dataset for training the model. target : string ...
src/unity/python/turicreate/toolkits/classifier/_classifier.py
def create(dataset, target, features=None, validation_set = 'auto', verbose=True): """ Automatically create a suitable classifier model based on the provided training data. To use specific options of a desired model, use the ``create`` function of the corresponding model. Parameters ...
def create(dataset, target, features=None, validation_set = 'auto', verbose=True): """ Automatically create a suitable classifier model based on the provided training data. To use specific options of a desired model, use the ``create`` function of the corresponding model. Parameters ...
[ "Automatically", "create", "a", "suitable", "classifier", "model", "based", "on", "the", "provided", "training", "data", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/_classifier.py#L12-L106
[ "def", "create", "(", "dataset", ",", "target", ",", "features", "=", "None", ",", "validation_set", "=", "'auto'", ",", "verbose", "=", "True", ")", ":", "return", "_sl", ".", "create_classification_with_model_selector", "(", "dataset", ",", "target", ",", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
GFrame.add_column
Adds the specified column to this SFrame. The number of elements in the data given must match every other column of the SFrame. If inplace == False (default) this operation does not modify the current SFrame, returning a new SFrame. If inplace == True, this operation modifies the curr...
src/unity/python/turicreate/data_structures/gframe.py
def add_column(self, data, column_name="", inplace=False): """ Adds the specified column to this SFrame. The number of elements in the data given must match every other column of the SFrame. If inplace == False (default) this operation does not modify the current SFrame, return...
def add_column(self, data, column_name="", inplace=False): """ Adds the specified column to this SFrame. The number of elements in the data given must match every other column of the SFrame. If inplace == False (default) this operation does not modify the current SFrame, return...
[ "Adds", "the", "specified", "column", "to", "this", "SFrame", ".", "The", "number", "of", "elements", "in", "the", "data", "given", "must", "match", "every", "other", "column", "of", "the", "SFrame", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/gframe.py#L62-L101
[ "def", "add_column", "(", "self", ",", "data", ",", "column_name", "=", "\"\"", ",", "inplace", "=", "False", ")", ":", "# Check type for pandas dataframe or SArray?", "if", "not", "isinstance", "(", "data", ",", "SArray", ")", ":", "raise", "TypeError", "(", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
GFrame.add_columns
Adds columns to the SFrame. The number of elements in all columns must match every other column of the SFrame. If inplace == False (default) this operation does not modify the current SFrame, returning a new SFrame. If inplace == True, this operation modifies the current SFram...
src/unity/python/turicreate/data_structures/gframe.py
def add_columns(self, data, column_names=None, inplace=False): """ Adds columns to the SFrame. The number of elements in all columns must match every other column of the SFrame. If inplace == False (default) this operation does not modify the current SFrame, returning a new SFr...
def add_columns(self, data, column_names=None, inplace=False): """ Adds columns to the SFrame. The number of elements in all columns must match every other column of the SFrame. If inplace == False (default) this operation does not modify the current SFrame, returning a new SFr...
[ "Adds", "columns", "to", "the", "SFrame", ".", "The", "number", "of", "elements", "in", "all", "columns", "must", "match", "every", "other", "column", "of", "the", "SFrame", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/gframe.py#L104-L154
[ "def", "add_columns", "(", "self", ",", "data", ",", "column_names", "=", "None", ",", "inplace", "=", "False", ")", ":", "datalist", "=", "data", "if", "isinstance", "(", "data", ",", "SFrame", ")", ":", "other", "=", "data", "datalist", "=", "[", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
GFrame.remove_column
Removes the column with the given name from the SFrame. If inplace == False (default) this operation does not modify the current SFrame, returning a new SFrame. If inplace == True, this operation modifies the current SFrame, returning self. Parameters ---------- ...
src/unity/python/turicreate/data_structures/gframe.py
def remove_column(self, column_name, inplace=False): """ Removes the column with the given name from the SFrame. If inplace == False (default) this operation does not modify the current SFrame, returning a new SFrame. If inplace == True, this operation modifies the current ...
def remove_column(self, column_name, inplace=False): """ Removes the column with the given name from the SFrame. If inplace == False (default) this operation does not modify the current SFrame, returning a new SFrame. If inplace == True, this operation modifies the current ...
[ "Removes", "the", "column", "with", "the", "given", "name", "from", "the", "SFrame", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/gframe.py#L157-L195
[ "def", "remove_column", "(", "self", ",", "column_name", ",", "inplace", "=", "False", ")", ":", "if", "column_name", "not", "in", "self", ".", "column_names", "(", ")", ":", "raise", "KeyError", "(", "'Cannot find column %s'", "%", "column_name", ")", "if",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
GFrame.swap_columns
Swaps the columns with the given names. If inplace == False (default) this operation does not modify the current SFrame, returning a new SFrame. If inplace == True, this operation modifies the current SFrame, returning self. Parameters ---------- column_name_1 ...
src/unity/python/turicreate/data_structures/gframe.py
def swap_columns(self, column_name_1, column_name_2, inplace=False): """ Swaps the columns with the given names. If inplace == False (default) this operation does not modify the current SFrame, returning a new SFrame. If inplace == True, this operation modifies the current ...
def swap_columns(self, column_name_1, column_name_2, inplace=False): """ Swaps the columns with the given names. If inplace == False (default) this operation does not modify the current SFrame, returning a new SFrame. If inplace == True, this operation modifies the current ...
[ "Swaps", "the", "columns", "with", "the", "given", "names", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/gframe.py#L211-L243
[ "def", "swap_columns", "(", "self", ",", "column_name_1", ",", "column_name_2", ",", "inplace", "=", "False", ")", ":", "if", "inplace", ":", "self", ".", "__is_dirty__", "=", "True", "with", "cython_context", "(", ")", ":", "if", "self", ".", "_is_vertex_...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
GFrame.rename
Rename the columns using the 'names' dict. This changes the names of the columns given as the keys and replaces them with the names given as the values. If inplace == False (default) this operation does not modify the current SFrame, returning a new SFrame. If inplace == True,...
src/unity/python/turicreate/data_structures/gframe.py
def rename(self, names, inplace=False): """ Rename the columns using the 'names' dict. This changes the names of the columns given as the keys and replaces them with the names given as the values. If inplace == False (default) this operation does not modify the current ...
def rename(self, names, inplace=False): """ Rename the columns using the 'names' dict. This changes the names of the columns given as the keys and replaces them with the names given as the values. If inplace == False (default) this operation does not modify the current ...
[ "Rename", "the", "columns", "using", "the", "names", "dict", ".", "This", "changes", "the", "names", "of", "the", "columns", "given", "as", "the", "keys", "and", "replaces", "them", "with", "the", "names", "given", "as", "the", "values", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/gframe.py#L245-L279
[ "def", "rename", "(", "self", ",", "names", ",", "inplace", "=", "False", ")", ":", "if", "(", "type", "(", "names", ")", "is", "not", "dict", ")", ":", "raise", "TypeError", "(", "'names must be a dictionary: oldname -> newname'", ")", "if", "inplace", ":...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
GFrame.num_rows
Returns the number of rows. Returns ------- out : int Number of rows in the SFrame.
src/unity/python/turicreate/data_structures/gframe.py
def num_rows(self): """ Returns the number of rows. Returns ------- out : int Number of rows in the SFrame. """ if self._is_vertex_frame(): return self.__graph__.summary()['num_vertices'] elif self._is_edge_frame(): ret...
def num_rows(self): """ Returns the number of rows. Returns ------- out : int Number of rows in the SFrame. """ if self._is_vertex_frame(): return self.__graph__.summary()['num_vertices'] elif self._is_edge_frame(): ret...
[ "Returns", "the", "number", "of", "rows", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/gframe.py#L321-L333
[ "def", "num_rows", "(", "self", ")", ":", "if", "self", ".", "_is_vertex_frame", "(", ")", ":", "return", "self", ".", "__graph__", ".", "summary", "(", ")", "[", "'num_vertices'", "]", "elif", "self", ".", "_is_edge_frame", "(", ")", ":", "return", "s...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
GFrame.column_names
Returns the column names. Returns ------- out : list[string] Column names of the SFrame.
src/unity/python/turicreate/data_structures/gframe.py
def column_names(self): """ Returns the column names. Returns ------- out : list[string] Column names of the SFrame. """ if self._is_vertex_frame(): return self.__graph__.__proxy__.get_vertex_fields() elif self._is_edge_frame(): ...
def column_names(self): """ Returns the column names. Returns ------- out : list[string] Column names of the SFrame. """ if self._is_vertex_frame(): return self.__graph__.__proxy__.get_vertex_fields() elif self._is_edge_frame(): ...
[ "Returns", "the", "column", "names", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/gframe.py#L346-L358
[ "def", "column_names", "(", "self", ")", ":", "if", "self", ".", "_is_vertex_frame", "(", ")", ":", "return", "self", ".", "__graph__", ".", "__proxy__", ".", "get_vertex_fields", "(", ")", "elif", "self", ".", "_is_edge_frame", "(", ")", ":", "return", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
GFrame.column_types
Returns the column types. Returns ------- out : list[type] Column types of the SFrame.
src/unity/python/turicreate/data_structures/gframe.py
def column_types(self): """ Returns the column types. Returns ------- out : list[type] Column types of the SFrame. """ if self.__type__ == VERTEX_GFRAME: return self.__graph__.__proxy__.get_vertex_field_types() elif self.__type__ =...
def column_types(self): """ Returns the column types. Returns ------- out : list[type] Column types of the SFrame. """ if self.__type__ == VERTEX_GFRAME: return self.__graph__.__proxy__.get_vertex_field_types() elif self.__type__ =...
[ "Returns", "the", "column", "types", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/gframe.py#L360-L372
[ "def", "column_types", "(", "self", ")", ":", "if", "self", ".", "__type__", "==", "VERTEX_GFRAME", ":", "return", "self", ".", "__graph__", ".", "__proxy__", ".", "get_vertex_field_types", "(", ")", "elif", "self", ".", "__type__", "==", "EDGE_GFRAME", ":",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create
Automatically create a suitable regression model based on the provided training data. To use specific options of a desired model, use the ``create`` function of the corresponding model. Parameters ---------- dataset : SFrame Dataset for training the model. target : str The...
src/unity/python/turicreate/toolkits/regression/_regression.py
def create(dataset, target, features=None, validation_set = 'auto', verbose=True): """ Automatically create a suitable regression model based on the provided training data. To use specific options of a desired model, use the ``create`` function of the corresponding model. Parameters ...
def create(dataset, target, features=None, validation_set = 'auto', verbose=True): """ Automatically create a suitable regression model based on the provided training data. To use specific options of a desired model, use the ``create`` function of the corresponding model. Parameters ...
[ "Automatically", "create", "a", "suitable", "regression", "model", "based", "on", "the", "provided", "training", "data", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/regression/_regression.py#L14-L116
[ "def", "create", "(", "dataset", ",", "target", ",", "features", "=", "None", ",", "validation_set", "=", "'auto'", ",", "verbose", "=", "True", ")", ":", "dataset", ",", "validation_set", "=", "_validate_data", "(", "dataset", ",", "target", ",", "feature...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
removable
node is removable only if all of its children are as well.
src/unity/python/turicreate/meta/asttools/mutators/prune_mutator.py
def removable(self, node): ''' node is removable only if all of its children are as well. ''' throw_away = [] for child in self.children(node): throw_away.append(self.visit(child)) if self.mode == 'exclusive': return all(throw_away) elif self.mode == 'inclusive': ret...
def removable(self, node): ''' node is removable only if all of its children are as well. ''' throw_away = [] for child in self.children(node): throw_away.append(self.visit(child)) if self.mode == 'exclusive': return all(throw_away) elif self.mode == 'inclusive': ret...
[ "node", "is", "removable", "only", "if", "all", "of", "its", "children", "are", "as", "well", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/asttools/mutators/prune_mutator.py#L17-L30
[ "def", "removable", "(", "self", ",", "node", ")", ":", "throw_away", "=", "[", "]", "for", "child", "in", "self", ".", "children", "(", "node", ")", ":", "throw_away", ".", "append", "(", "self", ".", "visit", "(", "child", ")", ")", "if", "self",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
PruneVisitor.reduce
remove nodes from a list
src/unity/python/turicreate/meta/asttools/mutators/prune_mutator.py
def reduce(self, body): ''' remove nodes from a list ''' i = 0 while i < len(body): stmnt = body[i] if self.visit(stmnt): body.pop(i) else: i += 1
def reduce(self, body): ''' remove nodes from a list ''' i = 0 while i < len(body): stmnt = body[i] if self.visit(stmnt): body.pop(i) else: i += 1
[ "remove", "nodes", "from", "a", "list" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/asttools/mutators/prune_mutator.py#L52-L62
[ "def", "reduce", "(", "self", ",", "body", ")", ":", "i", "=", "0", "while", "i", "<", "len", "(", "body", ")", ":", "stmnt", "=", "body", "[", "i", "]", "if", "self", ".", "visit", "(", "stmnt", ")", ":", "body", ".", "pop", "(", "i", ")",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
load_audio
Loads WAV file(s) from a path. Parameters ---------- path : str Path to WAV files to be loaded. with_path : bool, optional Indicates whether a path column is added to the returned SFrame. recursive : bool, optional Indicates whether ``load_audio`` should do a recursive dir...
src/unity/python/turicreate/toolkits/audio_analysis/audio_analysis.py
def load_audio(path, with_path=True, recursive=True, ignore_failure=True, random_order=False): """ Loads WAV file(s) from a path. Parameters ---------- path : str Path to WAV files to be loaded. with_path : bool, optional Indicates whether a path column is added to the returned...
def load_audio(path, with_path=True, recursive=True, ignore_failure=True, random_order=False): """ Loads WAV file(s) from a path. Parameters ---------- path : str Path to WAV files to be loaded. with_path : bool, optional Indicates whether a path column is added to the returned...
[ "Loads", "WAV", "file", "(", "s", ")", "from", "a", "path", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/audio_analysis/audio_analysis.py#L21-L95
[ "def", "load_audio", "(", "path", ",", "with_path", "=", "True", ",", "recursive", "=", "True", ",", "ignore_failure", "=", "True", ",", "random_order", "=", "False", ")", ":", "from", "scipy", ".", "io", "import", "wavfile", "as", "_wavfile", "all_wav_fil...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
SymbolDatabase.RegisterMessage
Registers the given message type in the local database. Calls to GetSymbol() and GetMessages() will return messages registered here. Args: message: a message.Message, to be registered. Returns: The provided message.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/symbol_database.py
def RegisterMessage(self, message): """Registers the given message type in the local database. Calls to GetSymbol() and GetMessages() will return messages registered here. Args: message: a message.Message, to be registered. Returns: The provided message. """ desc = message.DESCRI...
def RegisterMessage(self, message): """Registers the given message type in the local database. Calls to GetSymbol() and GetMessages() will return messages registered here. Args: message: a message.Message, to be registered. Returns: The provided message. """ desc = message.DESCRI...
[ "Registers", "the", "given", "message", "type", "in", "the", "local", "database", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/symbol_database.py#L68-L83
[ "def", "RegisterMessage", "(", "self", ",", "message", ")", ":", "desc", "=", "message", ".", "DESCRIPTOR", "self", ".", "_classes", "[", "desc", ".", "full_name", "]", "=", "message", "self", ".", "pool", ".", "AddDescriptor", "(", "desc", ")", "return"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
SymbolDatabase.GetMessages
Gets all registered messages from a specified file. Only messages already created and registered will be returned; (this is the case for imported _pb2 modules) But unlike MessageFactory, this version also returns already defined nested messages, but does not register any message extensions. Args: ...
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/symbol_database.py
def GetMessages(self, files): # TODO(amauryfa): Fix the differences with MessageFactory. """Gets all registered messages from a specified file. Only messages already created and registered will be returned; (this is the case for imported _pb2 modules) But unlike MessageFactory, this version also re...
def GetMessages(self, files): # TODO(amauryfa): Fix the differences with MessageFactory. """Gets all registered messages from a specified file. Only messages already created and registered will be returned; (this is the case for imported _pb2 modules) But unlike MessageFactory, this version also re...
[ "Gets", "all", "registered", "messages", "from", "a", "specified", "file", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/symbol_database.py#L137-L173
[ "def", "GetMessages", "(", "self", ",", "files", ")", ":", "# TODO(amauryfa): Fix the differences with MessageFactory.", "def", "_GetAllMessageNames", "(", "desc", ")", ":", "\"\"\"Walk a message Descriptor and recursively yields all message names.\"\"\"", "yield", "desc", ".", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_string_hash
String hash (djb2) with consistency between py2/py3 and persistency between runs (unlike `hash`).
src/unity/python/turicreate/toolkits/object_detector/util/_visualization.py
def _string_hash(s): """String hash (djb2) with consistency between py2/py3 and persistency between runs (unlike `hash`).""" h = 5381 for c in s: h = h * 33 + ord(c) return h
def _string_hash(s): """String hash (djb2) with consistency between py2/py3 and persistency between runs (unlike `hash`).""" h = 5381 for c in s: h = h * 33 + ord(c) return h
[ "String", "hash", "(", "djb2", ")", "with", "consistency", "between", "py2", "/", "py3", "and", "persistency", "between", "runs", "(", "unlike", "hash", ")", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/object_detector/util/_visualization.py#L14-L19
[ "def", "_string_hash", "(", "s", ")", ":", "h", "=", "5381", "for", "c", "in", "s", ":", "h", "=", "h", "*", "33", "+", "ord", "(", "c", ")", "return", "h" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
draw_bounding_boxes
Visualizes bounding boxes (ground truth or predictions) by returning annotated copies of the images. Parameters ---------- images: SArray or Image An `SArray` of type `Image`. A single `Image` instance may also be given. annotations: SArray or list An `SArray` of annotation...
src/unity/python/turicreate/toolkits/object_detector/util/_visualization.py
def draw_bounding_boxes(images, annotations, confidence_threshold=0): """ Visualizes bounding boxes (ground truth or predictions) by returning annotated copies of the images. Parameters ---------- images: SArray or Image An `SArray` of type `Image`. A single `Image` instance may also be...
def draw_bounding_boxes(images, annotations, confidence_threshold=0): """ Visualizes bounding boxes (ground truth or predictions) by returning annotated copies of the images. Parameters ---------- images: SArray or Image An `SArray` of type `Image`. A single `Image` instance may also be...
[ "Visualizes", "bounding", "boxes", "(", "ground", "truth", "or", "predictions", ")", "by", "returning", "annotated", "copies", "of", "the", "images", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/object_detector/util/_visualization.py#L94-L151
[ "def", "draw_bounding_boxes", "(", "images", ",", "annotations", ",", "confidence_threshold", "=", "0", ")", ":", "_numeric_param_check_range", "(", "'confidence_threshold'", ",", "confidence_threshold", ",", "0.0", ",", "1.0", ")", "from", "PIL", "import", "Image",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create
Create a :class:`~turicreate.toolkits.SupervisedLearningModel`, This is generic function that allows you to create any model that implements SupervisedLearningModel This function is normally not called, call specific model's create function instead Parameters ---------- dataset : SFrame ...
src/unity/python/turicreate/toolkits/_supervised_learning.py
def create(dataset, target, model_name, features=None, validation_set='auto', distributed='auto', verbose=True, seed=None, **kwargs): """ Create a :class:`~turicreate.toolkits.SupervisedLearningModel`, This is generic function that allows you to create any model that implements Su...
def create(dataset, target, model_name, features=None, validation_set='auto', distributed='auto', verbose=True, seed=None, **kwargs): """ Create a :class:`~turicreate.toolkits.SupervisedLearningModel`, This is generic function that allows you to create any model that implements Su...
[ "Create", "a", ":", "class", ":", "~turicreate", ".", "toolkits", ".", "SupervisedLearningModel" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_supervised_learning.py#L261-L334
[ "def", "create", "(", "dataset", ",", "target", ",", "model_name", ",", "features", "=", "None", ",", "validation_set", "=", "'auto'", ",", "distributed", "=", "'auto'", ",", "verbose", "=", "True", ",", "seed", "=", "None", ",", "*", "*", "kwargs", ")...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create_classification_with_model_selector
Create a :class:`~turicreate.toolkits.SupervisedLearningModel`, This is generic function that allows you to create any model that implements SupervisedLearningModel. This function is normally not called, call specific model's create function instead. Parameters ---------- dataset : SFrame ...
src/unity/python/turicreate/toolkits/_supervised_learning.py
def create_classification_with_model_selector(dataset, target, model_selector, features=None, validation_set='auto', verbose=True): """ Create a :class:`~turicreate.toolkits.SupervisedLearningModel`, This is generic function that allows you to create any model that implements SupervisedLearningMode...
def create_classification_with_model_selector(dataset, target, model_selector, features=None, validation_set='auto', verbose=True): """ Create a :class:`~turicreate.toolkits.SupervisedLearningModel`, This is generic function that allows you to create any model that implements SupervisedLearningMode...
[ "Create", "a", ":", "class", ":", "~turicreate", ".", "toolkits", ".", "SupervisedLearningModel" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_supervised_learning.py#L337-L460
[ "def", "create_classification_with_model_selector", "(", "dataset", ",", "target", ",", "model_selector", ",", "features", "=", "None", ",", "validation_set", "=", "'auto'", ",", "verbose", "=", "True", ")", ":", "# Perform error-checking and trim inputs to specified colu...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
SupervisedLearningModel.predict
Return predictions for ``dataset``, using the trained supervised_learning model. Predictions are generated as class labels (0 or 1). Parameters ---------- dataset : SFrame Dataset of new observations. Must include columns with the same names as the featur...
src/unity/python/turicreate/toolkits/_supervised_learning.py
def predict(self, dataset, missing_value_action='auto', output_type='', options={}, **kwargs): """ Return predictions for ``dataset``, using the trained supervised_learning model. Predictions are generated as class labels (0 or 1). Parameters ---------- ...
def predict(self, dataset, missing_value_action='auto', output_type='', options={}, **kwargs): """ Return predictions for ``dataset``, using the trained supervised_learning model. Predictions are generated as class labels (0 or 1). Parameters ---------- ...
[ "Return", "predictions", "for", "dataset", "using", "the", "trained", "supervised_learning", "model", ".", "Predictions", "are", "generated", "as", "class", "labels", "(", "0", "or", "1", ")", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_supervised_learning.py#L59-L116
[ "def", "predict", "(", "self", ",", "dataset", ",", "missing_value_action", "=", "'auto'", ",", "output_type", "=", "''", ",", "options", "=", "{", "}", ",", "*", "*", "kwargs", ")", ":", "if", "missing_value_action", "==", "'auto'", ":", "missing_value_ac...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
SupervisedLearningModel.evaluate
Evaluate the model by making predictions of target values and comparing these to actual values. Parameters ---------- dataset : SFrame Dataset in the same format used for training. The columns names and types of the dataset must be the same as that used in traini...
src/unity/python/turicreate/toolkits/_supervised_learning.py
def evaluate(self, dataset, metric="auto", missing_value_action='auto', with_predictions=False, options={}, **kwargs): """ Evaluate the model by making predictions of target values and comparing these to actual values. Parameters ---------- dataset : SFr...
def evaluate(self, dataset, metric="auto", missing_value_action='auto', with_predictions=False, options={}, **kwargs): """ Evaluate the model by making predictions of target values and comparing these to actual values. Parameters ---------- dataset : SFr...
[ "Evaluate", "the", "model", "by", "making", "predictions", "of", "target", "values", "and", "comparing", "these", "to", "actual", "values", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_supervised_learning.py#L118-L159
[ "def", "evaluate", "(", "self", ",", "dataset", ",", "metric", "=", "\"auto\"", ",", "missing_value_action", "=", "'auto'", ",", "with_predictions", "=", "False", ",", "options", "=", "{", "}", ",", "*", "*", "kwargs", ")", ":", "if", "missing_value_action...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Classifier.classify
Return predictions for ``dataset``, using the trained supervised_learning model. Predictions are generated as class labels (0 or 1). Parameters ---------- dataset: SFrame Dataset of new observations. Must include columns with the same names as the feature...
src/unity/python/turicreate/toolkits/_supervised_learning.py
def classify(self, dataset, missing_value_action='auto'): """ Return predictions for ``dataset``, using the trained supervised_learning model. Predictions are generated as class labels (0 or 1). Parameters ---------- dataset: SFrame Dataset of new obs...
def classify(self, dataset, missing_value_action='auto'): """ Return predictions for ``dataset``, using the trained supervised_learning model. Predictions are generated as class labels (0 or 1). Parameters ---------- dataset: SFrame Dataset of new obs...
[ "Return", "predictions", "for", "dataset", "using", "the", "trained", "supervised_learning", "model", ".", "Predictions", "are", "generated", "as", "class", "labels", "(", "0", "or", "1", ")", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_supervised_learning.py#L206-L245
[ "def", "classify", "(", "self", ",", "dataset", ",", "missing_value_action", "=", "'auto'", ")", ":", "if", "(", "missing_value_action", "==", "'auto'", ")", ":", "missing_value_action", "=", "select_default_missing_value_policy", "(", "self", ",", "'classify'", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
BoostedTreesRegression.evaluate
Evaluate the model on the given dataset. Parameters ---------- dataset : SFrame Dataset in the same format used for training. The columns names and types of the dataset must be the same as that used in training. metric : str, optional Name of the eva...
src/unity/python/turicreate/toolkits/regression/boosted_trees_regression.py
def evaluate(self, dataset, metric='auto', missing_value_action='auto'): """ Evaluate the model on the given dataset. Parameters ---------- dataset : SFrame Dataset in the same format used for training. The columns names and types of the dataset must be t...
def evaluate(self, dataset, metric='auto', missing_value_action='auto'): """ Evaluate the model on the given dataset. Parameters ---------- dataset : SFrame Dataset in the same format used for training. The columns names and types of the dataset must be t...
[ "Evaluate", "the", "model", "on", "the", "given", "dataset", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/regression/boosted_trees_regression.py#L152-L201
[ "def", "evaluate", "(", "self", ",", "dataset", ",", "metric", "=", "'auto'", ",", "missing_value_action", "=", "'auto'", ")", ":", "_raise_error_evaluation_metric_is_valid", "(", "metric", ",", "[", "'auto'", ",", "'rmse'", ",", "'max_error'", "]", ")", "retu...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
BoostedTreesRegression.predict
Predict the target column of the given dataset. The target column is provided during :func:`~turicreate.boosted_trees_regression.create`. If the target column is in the `dataset` it will be ignored. Parameters ---------- dataset : SFrame A dataset that has the...
src/unity/python/turicreate/toolkits/regression/boosted_trees_regression.py
def predict(self, dataset, missing_value_action='auto'): """ Predict the target column of the given dataset. The target column is provided during :func:`~turicreate.boosted_trees_regression.create`. If the target column is in the `dataset` it will be ignored. Parameters...
def predict(self, dataset, missing_value_action='auto'): """ Predict the target column of the given dataset. The target column is provided during :func:`~turicreate.boosted_trees_regression.create`. If the target column is in the `dataset` it will be ignored. Parameters...
[ "Predict", "the", "target", "column", "of", "the", "given", "dataset", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/regression/boosted_trees_regression.py#L230-L271
[ "def", "predict", "(", "self", ",", "dataset", ",", "missing_value_action", "=", "'auto'", ")", ":", "return", "super", "(", "BoostedTreesRegression", ",", "self", ")", ".", "predict", "(", "dataset", ",", "output_type", "=", "'margin'", ",", "missing_value_ac...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
print_code
Disassemble a code object.
src/unity/python/turicreate/meta/decompiler/disassemble.py
def print_code(co, lasti= -1, level=0): """Disassemble a code object.""" code = co.co_code for constant in co.co_consts: print( '| |' * level, end=' ') print( 'constant:', constant) labels = findlabels(code) linestarts = dict(findlinestarts(co)) n = len...
def print_code(co, lasti= -1, level=0): """Disassemble a code object.""" code = co.co_code for constant in co.co_consts: print( '| |' * level, end=' ') print( 'constant:', constant) labels = findlabels(code) linestarts = dict(findlinestarts(co)) n = len...
[ "Disassemble", "a", "code", "object", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/decompiler/disassemble.py#L29-L92
[ "def", "print_code", "(", "co", ",", "lasti", "=", "-", "1", ",", "level", "=", "0", ")", ":", "code", "=", "co", ".", "co_code", "for", "constant", "in", "co", ".", "co_consts", ":", "print", "(", "'| |'", "*", "level", ",", "end", "=...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert
Convert a decision tree model to protobuf format. Parameters ---------- decision_tree : DecisionTreeRegressor A trained scikit-learn tree model. feature_names: [str] Name of the input columns. target: str Name of the output column. Returns ------- model_spec: ...
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_decision_tree_regressor.py
def convert(model, feature_names, target): """Convert a decision tree model to protobuf format. Parameters ---------- decision_tree : DecisionTreeRegressor A trained scikit-learn tree model. feature_names: [str] Name of the input columns. target: str Name of the output...
def convert(model, feature_names, target): """Convert a decision tree model to protobuf format. Parameters ---------- decision_tree : DecisionTreeRegressor A trained scikit-learn tree model. feature_names: [str] Name of the input columns. target: str Name of the output...
[ "Convert", "a", "decision", "tree", "model", "to", "protobuf", "format", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_decision_tree_regressor.py#L18-L42
[ "def", "convert", "(", "model", ",", "feature_names", ",", "target", ")", ":", "if", "not", "(", "_HAS_SKLEARN", ")", ":", "raise", "RuntimeError", "(", "'scikit-learn not found. scikit-learn conversion API is disabled.'", ")", "_sklearn_util", ".", "check_expected_type...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_check_prob_and_prob_vector
Check that the predictionsa are either probabilities of prob-vectors.
src/unity/python/turicreate/toolkits/evaluation.py
def _check_prob_and_prob_vector(predictions): """ Check that the predictionsa are either probabilities of prob-vectors. """ from .._deps import numpy ptype = predictions.dtype import array if ptype not in [float, numpy.ndarray, array.array, int]: err_msg = "Input `predictions` must...
def _check_prob_and_prob_vector(predictions): """ Check that the predictionsa are either probabilities of prob-vectors. """ from .._deps import numpy ptype = predictions.dtype import array if ptype not in [float, numpy.ndarray, array.array, int]: err_msg = "Input `predictions` must...
[ "Check", "that", "the", "predictionsa", "are", "either", "probabilities", "of", "prob", "-", "vectors", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L36-L48
[ "def", "_check_prob_and_prob_vector", "(", "predictions", ")", ":", "from", ".", ".", "_deps", "import", "numpy", "ptype", "=", "predictions", ".", "dtype", "import", "array", "if", "ptype", "not", "in", "[", "float", ",", "numpy", ".", "ndarray", ",", "ar...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_supervised_evaluation_error_checking
Perform basic error checking for the evaluation metrics. Check types and sizes of the inputs.
src/unity/python/turicreate/toolkits/evaluation.py
def _supervised_evaluation_error_checking(targets, predictions): """ Perform basic error checking for the evaluation metrics. Check types and sizes of the inputs. """ _raise_error_if_not_sarray(targets, "targets") _raise_error_if_not_sarray(predictions, "predictions") if (len(targets) != len...
def _supervised_evaluation_error_checking(targets, predictions): """ Perform basic error checking for the evaluation metrics. Check types and sizes of the inputs. """ _raise_error_if_not_sarray(targets, "targets") _raise_error_if_not_sarray(predictions, "predictions") if (len(targets) != len...
[ "Perform", "basic", "error", "checking", "for", "the", "evaluation", "metrics", ".", "Check", "types", "and", "sizes", "of", "the", "inputs", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L50-L59
[ "def", "_supervised_evaluation_error_checking", "(", "targets", ",", "predictions", ")", ":", "_raise_error_if_not_sarray", "(", "targets", ",", "\"targets\"", ")", "_raise_error_if_not_sarray", "(", "predictions", ",", "\"predictions\"", ")", "if", "(", "len", "(", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
log_loss
r""" Compute the logloss for the given targets and the given predicted probabilities. This quantity is defined to be the negative of the sum of the log probability of each observation, normalized by the number of observations: .. math:: \textrm{logloss} = - \frac{1}{N} \sum_{i \in 1,\ldots...
src/unity/python/turicreate/toolkits/evaluation.py
def log_loss(targets, predictions, index_map=None): r""" Compute the logloss for the given targets and the given predicted probabilities. This quantity is defined to be the negative of the sum of the log probability of each observation, normalized by the number of observations: .. math:: ...
def log_loss(targets, predictions, index_map=None): r""" Compute the logloss for the given targets and the given predicted probabilities. This quantity is defined to be the negative of the sum of the log probability of each observation, normalized by the number of observations: .. math:: ...
[ "r", "Compute", "the", "logloss", "for", "the", "given", "targets", "and", "the", "given", "predicted", "probabilities", ".", "This", "quantity", "is", "defined", "to", "be", "the", "negative", "of", "the", "sum", "of", "the", "log", "probability", "of", "...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L87-L245
[ "def", "log_loss", "(", "targets", ",", "predictions", ",", "index_map", "=", "None", ")", ":", "_supervised_evaluation_error_checking", "(", "targets", ",", "predictions", ")", "_check_prob_and_prob_vector", "(", "predictions", ")", "_check_target_not_float", "(", "t...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
max_error
r""" Compute the maximum absolute deviation between two SArrays. Parameters ---------- targets : SArray[float or int] An Sarray of ground truth target values. predictions : SArray[float or int] The prediction that corresponds to each target value. This vector must have the ...
src/unity/python/turicreate/toolkits/evaluation.py
def max_error(targets, predictions): r""" Compute the maximum absolute deviation between two SArrays. Parameters ---------- targets : SArray[float or int] An Sarray of ground truth target values. predictions : SArray[float or int] The prediction that corresponds to each target ...
def max_error(targets, predictions): r""" Compute the maximum absolute deviation between two SArrays. Parameters ---------- targets : SArray[float or int] An Sarray of ground truth target values. predictions : SArray[float or int] The prediction that corresponds to each target ...
[ "r", "Compute", "the", "maximum", "absolute", "deviation", "between", "two", "SArrays", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L248-L288
[ "def", "max_error", "(", "targets", ",", "predictions", ")", ":", "_supervised_evaluation_error_checking", "(", "targets", ",", "predictions", ")", "return", "_turicreate", ".", "extensions", ".", "_supervised_streaming_evaluator", "(", "targets", ",", "predictions", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
rmse
r""" Compute the root mean squared error between two SArrays. Parameters ---------- targets : SArray[float or int] An Sarray of ground truth target values. predictions : SArray[float or int] The prediction that corresponds to each target value. This vector must have the sam...
src/unity/python/turicreate/toolkits/evaluation.py
def rmse(targets, predictions): r""" Compute the root mean squared error between two SArrays. Parameters ---------- targets : SArray[float or int] An Sarray of ground truth target values. predictions : SArray[float or int] The prediction that corresponds to each target value. ...
def rmse(targets, predictions): r""" Compute the root mean squared error between two SArrays. Parameters ---------- targets : SArray[float or int] An Sarray of ground truth target values. predictions : SArray[float or int] The prediction that corresponds to each target value. ...
[ "r", "Compute", "the", "root", "mean", "squared", "error", "between", "two", "SArrays", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L290-L336
[ "def", "rmse", "(", "targets", ",", "predictions", ")", ":", "_supervised_evaluation_error_checking", "(", "targets", ",", "predictions", ")", "return", "_turicreate", ".", "extensions", ".", "_supervised_streaming_evaluator", "(", "targets", ",", "predictions", ",", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
confusion_matrix
r""" Compute the confusion matrix for classifier predictions. Parameters ---------- targets : SArray Ground truth class labels (cannot be of type float). predictions : SArray The prediction that corresponds to each target value. This vector must have the same length as ``ta...
src/unity/python/turicreate/toolkits/evaluation.py
def confusion_matrix(targets, predictions): r""" Compute the confusion matrix for classifier predictions. Parameters ---------- targets : SArray Ground truth class labels (cannot be of type float). predictions : SArray The prediction that corresponds to each target value. ...
def confusion_matrix(targets, predictions): r""" Compute the confusion matrix for classifier predictions. Parameters ---------- targets : SArray Ground truth class labels (cannot be of type float). predictions : SArray The prediction that corresponds to each target value. ...
[ "r", "Compute", "the", "confusion", "matrix", "for", "classifier", "predictions", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L337-L372
[ "def", "confusion_matrix", "(", "targets", ",", "predictions", ")", ":", "_supervised_evaluation_error_checking", "(", "targets", ",", "predictions", ")", "_check_same_type_not_float", "(", "targets", ",", "predictions", ")", "return", "_turicreate", ".", "extensions", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
accuracy
r""" Compute the accuracy score; which measures the fraction of predictions made by the classifier that are exactly correct. The score lies in the range [0,1] with 0 being the worst and 1 being the best. Parameters ---------- targets : SArray An SArray of ground truth class labels. Can ...
src/unity/python/turicreate/toolkits/evaluation.py
def accuracy(targets, predictions, average='micro'): r""" Compute the accuracy score; which measures the fraction of predictions made by the classifier that are exactly correct. The score lies in the range [0,1] with 0 being the worst and 1 being the best. Parameters ---------- targets : SA...
def accuracy(targets, predictions, average='micro'): r""" Compute the accuracy score; which measures the fraction of predictions made by the classifier that are exactly correct. The score lies in the range [0,1] with 0 being the worst and 1 being the best. Parameters ---------- targets : SA...
[ "r", "Compute", "the", "accuracy", "score", ";", "which", "measures", "the", "fraction", "of", "predictions", "made", "by", "the", "classifier", "that", "are", "exactly", "correct", ".", "The", "score", "lies", "in", "the", "range", "[", "0", "1", "]", "...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L374-L471
[ "def", "accuracy", "(", "targets", ",", "predictions", ",", "average", "=", "'micro'", ")", ":", "_supervised_evaluation_error_checking", "(", "targets", ",", "predictions", ")", "_check_same_type_not_float", "(", "targets", ",", "predictions", ")", "opts", "=", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
fbeta_score
r""" Compute the F-beta score. The F-beta score is the weighted harmonic mean of precision and recall. The score lies in the range [0,1] with 1 being ideal and 0 being the worst. The `beta` value is the weight given to `precision` vs `recall` in the combined score. `beta=0` considers only precision...
src/unity/python/turicreate/toolkits/evaluation.py
def fbeta_score(targets, predictions, beta=1.0, average='macro'): r""" Compute the F-beta score. The F-beta score is the weighted harmonic mean of precision and recall. The score lies in the range [0,1] with 1 being ideal and 0 being the worst. The `beta` value is the weight given to `precision` vs...
def fbeta_score(targets, predictions, beta=1.0, average='macro'): r""" Compute the F-beta score. The F-beta score is the weighted harmonic mean of precision and recall. The score lies in the range [0,1] with 1 being ideal and 0 being the worst. The `beta` value is the weight given to `precision` vs...
[ "r", "Compute", "the", "F", "-", "beta", "score", ".", "The", "F", "-", "beta", "score", "is", "the", "weighted", "harmonic", "mean", "of", "precision", "and", "recall", ".", "The", "score", "lies", "in", "the", "range", "[", "0", "1", "]", "with", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L474-L605
[ "def", "fbeta_score", "(", "targets", ",", "predictions", ",", "beta", "=", "1.0", ",", "average", "=", "'macro'", ")", ":", "_supervised_evaluation_error_checking", "(", "targets", ",", "predictions", ")", "_check_categorical_option_type", "(", "'average'", ",", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
f1_score
r""" Compute the F1 score (sometimes known as the balanced F-score or F-measure). The F1 score is commonly interpreted as the average of precision and recall. The score lies in the range [0,1] with 1 being ideal and 0 being the worst. The F1 score is defined as: .. math:: f_{1}...
src/unity/python/turicreate/toolkits/evaluation.py
def f1_score(targets, predictions, average='macro'): r""" Compute the F1 score (sometimes known as the balanced F-score or F-measure). The F1 score is commonly interpreted as the average of precision and recall. The score lies in the range [0,1] with 1 being ideal and 0 being the worst. The F1 ...
def f1_score(targets, predictions, average='macro'): r""" Compute the F1 score (sometimes known as the balanced F-score or F-measure). The F1 score is commonly interpreted as the average of precision and recall. The score lies in the range [0,1] with 1 being ideal and 0 being the worst. The F1 ...
[ "r", "Compute", "the", "F1", "score", "(", "sometimes", "known", "as", "the", "balanced", "F", "-", "score", "or", "F", "-", "measure", ")", ".", "The", "F1", "score", "is", "commonly", "interpreted", "as", "the", "average", "of", "precision", "and", "...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L607-L723
[ "def", "f1_score", "(", "targets", ",", "predictions", ",", "average", "=", "'macro'", ")", ":", "return", "fbeta_score", "(", "targets", ",", "predictions", ",", "beta", "=", "1.0", ",", "average", "=", "average", ")" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
precision
r""" Compute the precision score for classification tasks. The precision score quantifies the ability of a classifier to not label a `negative` example as `positive`. The precision score can be interpreted as the probability that a `positive` prediction made by the classifier is `positive`. The score i...
src/unity/python/turicreate/toolkits/evaluation.py
def precision(targets, predictions, average='macro'): r""" Compute the precision score for classification tasks. The precision score quantifies the ability of a classifier to not label a `negative` example as `positive`. The precision score can be interpreted as the probability that a `positive` pr...
def precision(targets, predictions, average='macro'): r""" Compute the precision score for classification tasks. The precision score quantifies the ability of a classifier to not label a `negative` example as `positive`. The precision score can be interpreted as the probability that a `positive` pr...
[ "r" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L725-L839
[ "def", "precision", "(", "targets", ",", "predictions", ",", "average", "=", "'macro'", ")", ":", "_supervised_evaluation_error_checking", "(", "targets", ",", "predictions", ")", "_check_categorical_option_type", "(", "'average'", ",", "average", ",", "[", "'micro'...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
auc
r""" Compute the area under the ROC curve for the given targets and predictions. Parameters ---------- targets : SArray An SArray containing the observed values. For binary classification, the alpha-numerically first category is considered the reference category. prediction...
src/unity/python/turicreate/toolkits/evaluation.py
def auc(targets, predictions, average='macro', index_map=None): r""" Compute the area under the ROC curve for the given targets and predictions. Parameters ---------- targets : SArray An SArray containing the observed values. For binary classification, the alpha-numerically first ca...
def auc(targets, predictions, average='macro', index_map=None): r""" Compute the area under the ROC curve for the given targets and predictions. Parameters ---------- targets : SArray An SArray containing the observed values. For binary classification, the alpha-numerically first ca...
[ "r", "Compute", "the", "area", "under", "the", "ROC", "curve", "for", "the", "given", "targets", "and", "predictions", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L1150-L1269
[ "def", "auc", "(", "targets", ",", "predictions", ",", "average", "=", "'macro'", ",", "index_map", "=", "None", ")", ":", "_supervised_evaluation_error_checking", "(", "targets", ",", "predictions", ")", "_check_categorical_option_type", "(", "'average'", ",", "a...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
check_library.get_library_meta
Fetches the meta data for the current library. The data could be in the superlib meta data file. If we can't find the data None is returned.
deps/src/boost_1_68_0/status/boost_check_library.py
def get_library_meta(self): ''' Fetches the meta data for the current library. The data could be in the superlib meta data file. If we can't find the data None is returned. ''' parent_dir = os.path.dirname(self.library_dir) if self.test_file_exists(os.path.join(self.libra...
def get_library_meta(self): ''' Fetches the meta data for the current library. The data could be in the superlib meta data file. If we can't find the data None is returned. ''' parent_dir = os.path.dirname(self.library_dir) if self.test_file_exists(os.path.join(self.libra...
[ "Fetches", "the", "meta", "data", "for", "the", "current", "library", ".", "The", "data", "could", "be", "in", "the", "superlib", "meta", "data", "file", ".", "If", "we", "can", "t", "find", "the", "data", "None", "is", "returned", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/status/boost_check_library.py#L182-L205
[ "def", "get_library_meta", "(", "self", ")", ":", "parent_dir", "=", "os", ".", "path", ".", "dirname", "(", "self", ".", "library_dir", ")", "if", "self", ".", "test_file_exists", "(", "os", ".", "path", ".", "join", "(", "self", ".", "library_dir", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert
Convert a trained XGBoost model to Core ML format. Parameters ---------- decision_tree : Booster A trained XGboost tree model. feature_names: [str] | str Names of input features that will be exposed in the Core ML model interface. Can be set to one of the following: ...
src/external/coremltools_wrap/coremltools/coremltools/converters/xgboost/_tree.py
def convert(model, feature_names = None, target = 'target', force_32bit_float = True): """ Convert a trained XGBoost model to Core ML format. Parameters ---------- decision_tree : Booster A trained XGboost tree model. feature_names: [str] | str Names of input features that will...
def convert(model, feature_names = None, target = 'target', force_32bit_float = True): """ Convert a trained XGBoost model to Core ML format. Parameters ---------- decision_tree : Booster A trained XGboost tree model. feature_names: [str] | str Names of input features that will...
[ "Convert", "a", "trained", "XGBoost", "model", "to", "Core", "ML", "format", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/xgboost/_tree.py#L9-L51
[ "def", "convert", "(", "model", ",", "feature_names", "=", "None", ",", "target", "=", "'target'", ",", "force_32bit_float", "=", "True", ")", ":", "return", "_MLModel", "(", "_convert_tree_ensemble", "(", "model", ",", "feature_names", ",", "target", ",", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
dumps
Dumps a serializable object to JSON. This API maps to the Python built-in json dumps method, with a few differences: * The return value is always valid JSON according to RFC 7159. * The input can be any of the following types: - SFrame - SArray - SGraph - single flexible_typ...
src/unity/python/turicreate/_json.py
def dumps(obj): """ Dumps a serializable object to JSON. This API maps to the Python built-in json dumps method, with a few differences: * The return value is always valid JSON according to RFC 7159. * The input can be any of the following types: - SFrame - SArray - SGraph ...
def dumps(obj): """ Dumps a serializable object to JSON. This API maps to the Python built-in json dumps method, with a few differences: * The return value is always valid JSON according to RFC 7159. * The input can be any of the following types: - SFrame - SArray - SGraph ...
[ "Dumps", "a", "serializable", "object", "to", "JSON", ".", "This", "API", "maps", "to", "the", "Python", "built", "-", "in", "json", "dumps", "method", "with", "a", "few", "differences", ":" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_json.py#L20-L38
[ "def", "dumps", "(", "obj", ")", ":", "(", "data", ",", "schema", ")", "=", "to_serializable", "(", "obj", ")", "return", "_json", ".", "dumps", "(", "{", "'data'", ":", "data", ",", "'schema'", ":", "schema", "}", ")" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
draw_strokes
Visualizes drawings (ground truth or predictions) by returning images to represent the stroke-based data from the user. Parameters ---------- stroke_based_drawings: SArray or list An `SArray` of type `list`. Each element in the SArray should be a list of strokes, where each stroke...
src/unity/python/turicreate/toolkits/drawing_classifier/util/_visualization.py
def draw_strokes(stroke_based_drawings): """ Visualizes drawings (ground truth or predictions) by returning images to represent the stroke-based data from the user. Parameters ---------- stroke_based_drawings: SArray or list An `SArray` of type `list`. Each element in the SArray ...
def draw_strokes(stroke_based_drawings): """ Visualizes drawings (ground truth or predictions) by returning images to represent the stroke-based data from the user. Parameters ---------- stroke_based_drawings: SArray or list An `SArray` of type `list`. Each element in the SArray ...
[ "Visualizes", "drawings", "(", "ground", "truth", "or", "predictions", ")", "by", "returning", "images", "to", "represent", "the", "stroke", "-", "based", "data", "from", "the", "user", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/drawing_classifier/util/_visualization.py#L10-L54
[ "def", "draw_strokes", "(", "stroke_based_drawings", ")", ":", "single_input", "=", "False", "if", "(", "not", "isinstance", "(", "stroke_based_drawings", ",", "_tc", ".", "SArray", ")", "and", "not", "isinstance", "(", "stroke_based_drawings", ",", "list", ")",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Transformer.fit
Fit a transformer using the SFrame `data`. Parameters ---------- data : SFrame The data used to fit the transformer. Returns ------- self (A fitted version of the object) See Also -------- transform, fit_transform Examples ...
src/unity/python/turicreate/toolkits/_feature_engineering/_feature_engineering.py
def fit(self, data): """ Fit a transformer using the SFrame `data`. Parameters ---------- data : SFrame The data used to fit the transformer. Returns ------- self (A fitted version of the object) See Also -------- tra...
def fit(self, data): """ Fit a transformer using the SFrame `data`. Parameters ---------- data : SFrame The data used to fit the transformer. Returns ------- self (A fitted version of the object) See Also -------- tra...
[ "Fit", "a", "transformer", "using", "the", "SFrame", "data", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_feature_engineering.py#L236-L262
[ "def", "fit", "(", "self", ",", "data", ")", ":", "_raise_error_if_not_sframe", "(", "data", ",", "\"data\"", ")", "self", ".", "__proxy__", ".", "fit", "(", "data", ")", "return", "self" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e