The least populated class in y has only 1

Apareceu o erro abaixo, o problema está no model_rbf_best.fit(inputs, outputs), as linhas e colunas são iguais e esse problema persiste.

raise ValueError(“The least populated class in y has only 1”

ValueError: The least populated class in y has only 1 member, which is too few. The minimum number of groups for any class cannot be less than 2.

base = pd.read_excel("TSLA.xlsx", sheet_name=4) base = base.dropna() base_treinamento = base.iloc[:, 1:2].values  janela = 60 previsores = [] preco_real = [] for i in range(janela, len(base_treinamento)):     previsores.append(base_treinamento[i-janela:i, 0])     preco_real.append(base_treinamento[i, 0])  inputs = np.array(previsores)     outputs = preco_real   # ################################################################## # # TESTE base_teste = pd.read_excel("TSLA_2019.xlsx") preco_real_teste = base_teste.iloc[:, 1:2].values base_completa = pd.concat((base['Abrir'], base_teste['Abrir']), axis = 0) entradas = base_completa[len(base_completa) - len(base_teste) - janela:].values entradas = entradas.reshape(-1, 1)  X_teste = [] for i in range(janela, len(entradas)):     X_teste.append(entradas[i-janela:i, 0]) X_teste = np.array(X_teste)  # ################################################################## # # SVR svr_kernels = ['rbf', 'poly', 'linear']  val_epsilon=[] dec=1 for j in range(2):     dec = dec*0.01     for i in range(25):         val = dec*(math.sin(i)+3+rd.uniform(0,10))         val_epsilon.append(val)  val_degree = [2, 3, 4, 5] val_gamma = np.logspace(-9, 3, 50) val_C = np.logspace(-3, 10, 10) val_coef = [0.0, 1.0, 2.0, 3.0]  for svr in svr_kernels:     mse_min = 500     if svr == 'rbf':         param_grid = dict(gamma=val_gamma, C=val_C)         cv = StratifiedShuffleSplit(n_splits=5, test_size=0.2, random_state=42)         model_rbf_best = GridSearchCV(SVR(kernel = svr), param_grid=param_grid, cv=cv)         model_rbf_best.fit(inputs, outputs) 

How to delete data from both tables or least one of them, when using “delete from … using … where” in Postgresql?

I have this sql script for my Postgresql db:

  DELETE FROM table1   USING table2   WHERE table2.frg_table1_id = table1.id   AND table1.id = $  1 

I want to it to always delete data from table1 if the condition table1.id = $ 1 is met. And, optionally, delete corresponding data from table2 too. Even when corresponding data in table2 doesn’t exist, it still must delete from table1

An issue now is that, it’ll delete data either from both tables or from none.

How should I twist my script?

any arithmetic progression of length 10 consisting of numbers in $S$ will contain at least a number in $P$


Let $ S= \left\{ 1,2,3,…,100 \right\}$ be a set of positive integers from $ 1$ to $ 100$ . Let $ P$ be a subset of $ S$ such that any arithmetic progression of length 10 consisting of numbers in $ S$ will contain at least a number in $ P$ . What is the smallest possible number of elements in $ P$ ?

Denote $ |P|$ as the number of elements in $ P$ . We shall find the smallest possible value of $ |P|$ .

For $ |P|=18$ , choose $ P = \left\{ 10,19,28,37,…,91,12,23,34,…,89 \right\}$ , which consists of all integers from $ S$ that equivalent to $ 1 \pmod 9$ or $ 1 \pmod {11}$ , excluding $ 1$ and $ 100$ . Then every arithmetic progression of length 10 will contain at least a number in $ P$ .

To prove that, let $ a,a+d,a+2d,…a+9d$ be an arithmetic progression of length 10 consisting of numbers in $ S$ with $ 1 \leq d \leq 11$ .

If $ gcd(d,9)=1$ , then there exists $ 0 \leq k \leq 9$ such that $ a+kd \equiv 1 \pmod 9$ . If $ a+kd=1$ or $ 100$ then $ k=0$ or $ 9$ respectively, and thus if $ d<11$ then there exist $ 0 \leq l \leq 9$ such that $ a+ld \equiv 1 \pmod 9$ and $ a+ld \neq 1, 100$ . If $ d=11$ then the arithmetic progression is $ 1,12,23,…,100$ , in which $ 12,23,…,89 \in P$ .

If $ gcd(d,9)>1$ and all elements of $ a,a+d,a+2d,…a+9d$ do not equal to $ 1$ $ \pmod 9$ , then $ d<11$ and thus $ gcd(d,11)=1$ Hence there must be a $ 0 \leq k \leq 9$ such that $ a+kd \equiv 1 \pmod {11}$ . If not, then $ a+10d \equiv 1 \pmod {11} \Leftrightarrow a = d+1$ ; but then $ a \equiv 1 \pmod 3$ , then atleast 3 elements in $ a,a+d,a+2d,…a+9d$ equal to $ 1$ $ \pmod 9$ .

However, for $ |P|<18$ , I can neither find such set $ P$ nor prove that $ |P|$ cannot be less than $ 18$ . So my question is:

Is it true that $ |P| \geq 18$ ? How can I prove it? If not, what is the minimum amount of elements in $ P$ ?

Also, I am wondering that:

If we replace 10 with an even number $ n$ ,and $ 100$ with $ n^2$ , is it true that $ |P| \geq 2(n-1)$ ?

Any answers or comments will be appreciated. If this question should be closed, please let me know. If this forum cannot answer my question, I will delete this question immediately.

What is the least intrusive way to make tiny changes in 2.3.1?

While I wasn’t terrible with Magento 1, M2 has such changes that I’m not sure where to start. And everyone talking about “plugins” simply copy and paste the developer’s guide and no one gives example or explains what the whys or hows.

What are the ways to make small UI improvements for these examples (extension or plugin or what is “an extension with a plugin”):

  1. In admin area, the bar appears encouraging you to update the cache. When I go to the page, it already knows which need updating, so I want to make those already selected.
  2. Remove the “Select All” option in drop-downs?
  3. Change from name in the order and contact Emails?
  4. Copy the comments block in adminhtml order page to checkout?

Everyone wants to make themes and grandiose projects, where I’m more about the smallest amount of changes and impact on the code.

Is the minimal Chern number of a toric manifold at least 2?

I would like to show that the minimal Chern number $ N_M$ of a toric manifold $ M$ is at least $ 2$ , where $ $ N_M := \underset{l>0}{\min} \lbrace \exists \ A \in H_2(M;\mathbb{Z}) \ : \ \langle c, A \rangle = l \rbrace, $ $ $ c$ denotes the first Chern class of $ (M,\omega)$ (for any choice of $ \omega$ -compatible complex structure), and $ \langle.,.\rangle$ is the natural pairing between cohomology and homology groups.

I don’t know how to prove this, but the following interpretation of the first Chern class might help.

Let $ (M^{2d},\omega, \mathbb{T})$ be a toric manifold, where $ \omega$ is the symplectic form and $ \mathbb{T}$ is a $ d$ -dimensional torus acting effectively and in a Hamiltonian way on $ (M,\omega)$ . Viewing $ M$ as a symplectic reduction of $ \mathbb{C}^n$ by the action of a $ k$ -dimensional subtorus $ \mathbb{K} \subset (S^1)^n$ (hence identifying $ \mathbb{T} \simeq (S^1)^n / \mathbb{K}$ ), one can show that there is a natural isomorphism $ $ H_2(M;\mathbb{Z}) \simeq \text{Lie}(\mathbb{K})_{\mathbb{Z}}, $ $ where the integral lattice $ \text{Lie}(\mathbb{K})_{\mathbb{Z}}$ is the kernel of the exponential map $ \exp: \text{Lie}(\mathbb{K}) \to \mathbb{K}$ . For any choice of $ \omega$ -compatible almost complex structure on $ M$ , the first Chern class $ c \in H^2(M;\mathbb{Z}) \simeq \text{Lie}(\mathbb{K})_{\mathbb{Z}}^*$ writes: $ $ c(m) = \underset{j=1}{\overset{n} \sum} m_j \quad m \in \text{Lie}(\mathbb{K})_{\mathbb{Z}} \quad \iota(m) = (m_1,…,m_n), $ $ where $ \iota : \text{Lie}(\mathbb{K}) \hookrightarrow \mathbb{R}^n$ is the inclusion of Lie algebras induced by the inclusion $ \mathbb{K} \subset (S^1)^n$ .

Of course, in general (when $ M$ is not toric), $ N_M$ can be equal to $ 1$ , and one can even have that $ \langle c, H_2(M;\mathbb{Z}) = 0$ (in which case one often writes $ N_M = \infty$ ). However, since any toric manifold has a decomposition in complex cells, it seems that $ N_M$ should be at least $ 2$ .

Any help will be appreciated. Thanks in advance.

Google Cloud gone to maintenance for at least a day. No way to get it working or extract data

We having yet another critical issue with Google Cloud SQL (MySQL Gen 2). Server gone to maintenance for almost a day, and still unusable. So our production and development databases are both trapped there. We can not restart the instance, we can not download backups or do some export. In essence, all controls are blocked for this server. We clicked at Help -> Send Feedback twice with screenshot and no reaction was given.

We can not afford another $ 150 per month aka $ 1800 for year for our startup to pay for fixing possible single “disaster of the year”!

Hey, Google, I can not believe that you do not see how that server cries with pain, shock and disbelief, shaking and covered with thick layer of dirty error logs!