[英]How do I get a right radial basis function that projects non-linearly separable data to linearly separable?
[英]How to code a linearly increasing function using `i` and `j` in a nested for loop?
如何在循環中創建i and
j`的線性增加函數?
In [2]: x = []
In [3]: for i in range(3):
...: for j in range(3):
...: x.append(i*j+i)
...:
...:
In [4]: x
Out[4]: [0, 0, 0, 1, 2, 3, 2, 4, 6]
也就是說, append
哪個函數將產生:
In [5]: x
Out[5]: [0, 1, 2, 3, 4, 5, 6, 7, 8]
這可能嗎?
您可以通過執行i
*( j
可以取的總值,這里是3)+ j
來獲得此值。
x.append(3 * i + j)
干得好:
x = []
for i in range(3):
for j in range(3):
x.append(i*3+j)
print(x)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.