摘要:        
```python import json import base64 # 输入 x = dict(a=1, b='555', name='中文') # 编码 y = json.dumps(x, indent=2).encode('utf-8') with open('b64.txt', 'wb')    
阅读全文
 
 
        
        posted @ 2021-08-17 16:30
bregman
阅读(87)
推荐(0)
        
 
		
    
        
        
摘要:        
* 必须捕获与非必须捕获异常。 用RuntimeException 抛出提示 ```java try { // todo } catch (Exception e) { String message = String.format("record=%s,keys=%s",checkPoints, a    
阅读全文
 
 
        
        posted @ 2021-08-13 12:08
bregman
阅读(27)
推荐(0)
        
 
		
    
        
        
摘要:        
* logging 捕获异常 ```python try: main(CtrFgConf, p.local, p.debug, **Params) except Exception as e: logging.exception(f'{e}:当前TF版本不是paitf? 提交命令中加参数--nopa    
阅读全文
 
 
        
        posted @ 2021-07-30 14:30
bregman
阅读(45)
推荐(0)
        
 
		
    
        
        
摘要:        
资料收藏 * 深入互联网广告中的出价模式(3合1完整版) https://mp.weixin.qq.com/s/B-IXNecE5CL19wOx2tJENg    
阅读全文
 
 
        
        posted @ 2021-07-21 10:36
bregman
阅读(71)
推荐(0)
        
 
		
    
        
        
摘要:        
* https://wrfranklin.org/Research/Short_Notes/pnpoly.html    
阅读全文
 
 
        
        posted @ 2021-06-23 14:29
bregman
阅读(33)
推荐(0)
        
 
		
    
        
        
摘要:        
# 定义 * 函数 $f:\mathbb{R}^n\to\mathbb{R},$ 它在点 $x \in \mathbb{R}^n$上的梯度定义为 $\mathrm{grad}_x(f):=\left[\frac{\partial f}{\partial x_1},\frac{\partial f}{    
阅读全文
 
 
        
        posted @ 2021-06-21 11:18
bregman
阅读(340)
推荐(0)
        
 
		
    
        
        
摘要:        
* 参考 https://github.com/tianheyu927/PCGrad/blob/master/PCGrad_tf.py * 定制优化函数,考虑多任务学习 https://arxiv.org/pdf/2001.06782.pdf    
阅读全文
 
 
        
        posted @ 2021-06-18 17:30
bregman
阅读(66)
推荐(0)
        
 
		
    
        
        
摘要:        
代码跳转. 如果不能跳转, 可能需要在.vscode/settings.json中加实际的代码路径,比如"python.analysis.extraPaths": ["code"], tensorflow 1.15.0前后的版本,无法代码提示,解决办法为 # cd ~/.local/lib/pyth    
阅读全文
 
 
        
        posted @ 2021-06-11 16:54
bregman
阅读(3712)
推荐(0)
        
 
		
    
        
        
摘要:        
如果 $A$ 是大小为 $m \times n$ 的实矩阵, $A$的精简形式的SVD分解为 $A = U\Sigma V^T$. 那么$A$的零空间,列空间, 行空间 分别为 ${\cal N}(A) = {\rm span}(V)^\perp$, ${\cal R}(A) = {\rm span    
阅读全文
 
 
        
        posted @ 2021-06-08 13:46
bregman
阅读(249)
推荐(0)
        
 
		
    
        
        
摘要:        
* 基于wine模式安装微信. 参考 https://github.com/zq1997/deepin-wine * 在4K屏幕下, 分辨率太高导致字体太小, 如下调整 
推荐(0)
        
 
		
    
        
        
摘要:        
2023更新 这本不错 https://course.rs/about-book.html 加了代理 cat $HOME/.cargo/config.toml [source.crates-io] replace-with = 'rsproxy' [source.rsproxy] registry     
阅读全文
 
 
        
        posted @ 2021-04-27 16:30
bregman
阅读(73)
推荐(0)
        
 
		
    
        
        
摘要:        
当前最新版本 5.44, 系统:macOS ### 安装 macports * 下载 MacPorts-2.6.4_1-11-BigSur.pkg 安装, 需要断网, 防止中间卡死。 * 配置国内代理, 配置文件中有提示。 # /opt/local/etc/macports/sources.conf    
阅读全文
 
 
        
        posted @ 2021-03-26 11:15
bregman
阅读(281)
推荐(0)
        
 
		
    
        
        
摘要:        
title: Dynamic Routing Between Capsules, NIPS 2017 author: Geoffrey E. Hinton url: [https://arxiv.org/abs/1710.09829](https://arxiv.org/abs/1710.09829    
阅读全文
 
 
        
        posted @ 2021-03-22 16:19
bregman
阅读(71)
推荐(0)
        
 
		
    
        
        
摘要:        
* 分辨率问题参考 https://blog.csdn.net/a1171936767/article/details/114324666 ```bash vim /opt/netease/netease-cloud-music/netease-cloud-music.bash # 增加分辨率参数,    
阅读全文
 
 
        
        posted @ 2021-03-21 13:03
bregman
阅读(84)
推荐(0)
        
            
        
        
摘要:        
* 输入法:fcitx * 系统环境:mint linux 20.1 * 解决方法:通过配置fcitx,延迟5秒解决. 
推荐(0)
        
 
		
    
        
        
摘要:        
``` \begin{subequations}\label{eq:ctr_shale} \begin{align} \min \sum_{j, k} r_{k} n_{k} \frac{V_{j}}{\theta_{j}}\left(x_{k j} -\theta_{j}\right)^{2} +    
阅读全文
 
 
        
        posted @ 2021-02-08 17:01
bregman
阅读(4503)
推荐(0)
        
 
		
    
        
        
摘要:        
https://help.aliyun.com/document_detail/27990.html 问题是pdf文档不见了, 不过源代码里还有链接。 源代码里中链接消失了, 但还能搜到pdf 查看源码找不到url了, 最新方法,Google搜索到 http://static-aliyun-doc.    
阅读全文
 
 
        
        posted @ 2021-01-26 13:48
bregman
阅读(257)
推荐(0)
        
 
		
    
        
        
摘要:        
见 https://github.com/willmcgugan/rich    
阅读全文
 
 
        
        posted @ 2020-12-03 11:35
bregman
阅读(369)
推荐(0)
        
 
		
    
        
        
摘要:        
* keys_len 如果是None的时候, 注释代码失败。 ```python # keys_len = keys.get_shape()[1] # queries = K.repeat_elements(query, keys_len, 1) keys_len = tf.shape(keys)[    
阅读全文
 
 
        
        posted @ 2020-11-18 15:02
bregman
阅读(324)
推荐(0)
        
 
		
    
        
        
摘要:        
稀疏矩阵(或三维以上稀疏张量)的测试例子 import tensorflow as tf import numpy as np sess = tf.InteractiveSession() # 稀疏tensor构造 import numpy as np A = tf.constant(np.rand    
阅读全文
 
 
        
        posted @ 2020-11-12 20:33
bregman
阅读(614)
推荐(0)
        
 
		
    
        
        
摘要:        
```python tf.app.flags.DEFINE_integer('num_blocks', 1, 'Number of blocks in each attention') tf.app.flags.DEFINE_integer('num_heads', 8, 'Number of he    
阅读全文
 
 
        
        posted @ 2020-11-09 19:58
bregman
阅读(143)
推荐(0)
        
 
		
    
        
        
摘要:        
```python # 计算正则项 # t_l2_reg = tf.nn.l2_loss(emb, name=reg_name) * l2_reg t_l2_reg = tf.reduce_mean(tf.reduce_sum(emb**2, axis=-1), name=reg_name) * l    
阅读全文
 
 
        
        posted @ 2020-11-05 15:52
bregman
阅读(176)
推荐(0)
        
 
		
    
        
        
摘要:        
* linux多线程下载 axel * 安装 ``` wget http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/a/axel-2.4-9.el7.x86_64.rpm rpm -ivh axel-2.4-9.el7.    
阅读全文
 
 
        
        posted @ 2020-10-21 17:22
bregman
阅读(146)
推荐(0)
        
 
		
    
        
        
摘要:        
* 对于统计变量, 比如交易次数, 通常在深度学习中处理方式是分箱,再embedding。 这样的分箱可能导致不够平滑, kv-memory 提供了一个新的方式, 感觉相对更加平滑。 * 论文见 [MULTI-MODAL REPRESENTATION LEARNING FOR SHORT VIDEO    
阅读全文
 
 
        
        posted @ 2020-10-19 11:14
bregman
阅读(330)
推荐(0)
        
 
		
    
        
        
摘要:        
* 分桶 获取ID ``` In [27]: sess= tf.InteractiveSession() In [31]: from tensorflow.contrib.layers.python.ops import bucketization_op In [32]: a= bucketizat    
阅读全文
 
 
        
        posted @ 2020-10-14 12:20
bregman
阅读(1390)
推荐(0)
        
 
		
    
        
        
摘要:        
auc, earlystopping model.compile('adagrad', 'binary_crossentropy', metrics=['binary_crossentropy', tf.keras.metrics.AUC(name='auc', num_thresholds=200    
阅读全文
 
 
        
        posted @ 2020-10-09 10:40
bregman
阅读(125)
推荐(0)
        
 
		
    
        
        
摘要:        
找到一个解决办法: 但是在secureCRT始终显示下划线,不显示高亮,在putty下显示高亮 解决方法: 使用vi打开/etc/profile 添加 export TERM=xterm-color 然后执行 source /etc/profile    
阅读全文
 
 
        
        posted @ 2020-09-29 15:29
bregman
阅读(404)
推荐(0)
        
 
		
    
        
        
摘要:        
```python def kv2sparse(lines, num_cols, sep=',', kv_sep=':', hash_key=False): """ 解析kv格式的数据. Parameters lines : string or string tensor the input dat    
阅读全文
 
 
        
        posted @ 2020-09-28 10:02
bregman
阅读(110)
推荐(0)
        
 
		
    
        
        
摘要:        
```python import threading def _task(func, args, n_thread=8): # 多线程并发执行所有任务 threads = map(lambda : threading.Thread(target=func, args=args), range(len    
阅读全文
 
 
        
        posted @ 2020-09-25 10:54
bregman
阅读(162)
推荐(0)
        
 
		
    
        
        
摘要:        
发一个别人整理的一个手册, 和包含了大部分实际应用中的算法。 * AI算法工程师手册 https://www.bookstack.cn/read/huaxiaozhuan-ai/5fb26f9d30c55109.md    
阅读全文
 
 
        
        posted @ 2020-09-17 11:51
bregman
阅读(247)
推荐(0)
        
 
		
    
        
        
摘要:        
## macOS下如何将音频输出转为输入 * 用途:google翻译, 钉钉同时录屏和声音, ... * soundflower 已经不支持在 macos big sur 系统里安装。 有一个代替的开源驱动BlackHole, 安装还更加简单。 * 参考 https://github.com/Exi    
阅读全文
 
 
        
        posted @ 2020-09-07 16:34
bregman
阅读(372)
推荐(0)
        
 
		
    
        
        
摘要:        
```python import numpy as np def focalloss(p, y, gamma=5): # https://blog.csdn.net/JNingWei/article/details/80038594 # https://www.cnblogs.com/king-lp    
阅读全文
 
 
        
        posted @ 2020-08-28 16:14
bregman
阅读(270)
推荐(0)
        
 
		
    
        
        
摘要:        
在 tf115 版本下, 通过ipython测试tf语法, 使用tab键提示会出现很多 warning, 干扰使用. 没有好办法, 如下解决: tf.logging.set_verbosity(tf.logging.ERROR) 更好的办法 from tensorflow.python.util i    
阅读全文
 
 
        
        posted @ 2020-08-24 14:58
bregman
阅读(161)
推荐(0)
        
 
		
    
        
        
摘要:        
* 切片函数 * tf.gather * tf.boolean_mask    
阅读全文
 
 
        
        posted @ 2020-08-13 20:00
bregman
阅读(221)
推荐(0)
        
 
		
    
        
        
摘要:        
(tf115) [xxxxx@macpro pai_tf_model] $ ~/.local/bin/jupyter-console import tensorflow as tf A = tf.SparseTensor(indices=[[0, 0], [1, 2]], values=[1, 2]    
阅读全文
 
 
        
        posted @ 2020-08-06 16:01
bregman
阅读(144)
推荐(0)
        
 
		
    
        
        
摘要:        
``` pip install ortools --user cd /root/.local/lib/python3.6/ zip -r ortools.zip site-packages ```    
阅读全文
 
 
        
        posted @ 2020-08-04 18:36
bregman
阅读(741)
推荐(0)
        
 
		
    
        
        
摘要:        
pid 控制算法, 用于参数调控进度    
阅读全文
 
 
        
        posted @ 2020-07-31 14:17
bregman
阅读(128)
推荐(0)
        
 
		
    
        
        
摘要:        
有时候git clone下来后,文件的权限不对,这样git会出现很多的改变,事实上是不需要提交的。 通过下面的配置可以让git忽略这种情况。 所有git库: git config --global core.fileMode false 当前库: git config core.fileMode f    
阅读全文
 
 
        
        posted @ 2020-07-23 13:06
bregman
阅读(655)
推荐(0)
        
 
		
    
        
        
摘要:        
对系数做约束。 ```python # encoding: utf-8 import numpy as np from scipy import optimize class nnegLR(object): def __init__(self, lambdo=1, fit_intercept=Tru    
阅读全文
 
 
        
        posted @ 2020-05-15 17:18
bregman
阅读(726)
推荐(0)
        
 
		
    
        
        
摘要:        
基于TF, pytorch等分布式框架, 求优化问题。 https://github.com/cvxgrp/cvxpylayers    
阅读全文
 
 
        
        posted @ 2020-04-15 18:18
bregman
阅读(333)
推荐(0)