super(channel_selection, self).__init__() self.indexes = nn.Parameter(torch.ones(num_channels))

时间: 2024-05-23 16:15:53 浏览: 181
这两行代码是一个类的构造函数,用于初始化类的属性。第一行代码调用了父类的构造函数并传递了 `channel_selection` 参数,以便父类可以正确地初始化。第二行代码创建了一个名为 `indexes` 的可训练参数(`nn.Parameter`),它是一个大小为 `num_channels` 的张量,每个元素都被初始化为 1。这个参数在模型训练时会被动态更新,用于选择输入数据中的哪些通道参与计算。
相关问题

def forward(self, data, org_edge_index): x = data.clone().detach() edge_index_sets = self.edge_index_sets device = data.device batch_num, node_num, all_feature = x.shape x = x.view(-1, all_feature).contiguous() gcn_outs = [] for i, edge_index in enumerate(edge_index_sets): edge_num = edge_index.shape[1] cache_edge_index = self.cache_edge_index_sets[i] if cache_edge_index is None or cache_edge_index.shape[1] != edge_num*batch_num: self.cache_edge_index_sets[i] = get_batch_edge_index(edge_index, batch_num, node_num).to(device) batch_edge_index = self.cache_edge_index_sets[i] all_embeddings = self.embedding(torch.arange(node_num).to(device)) weights_arr = all_embeddings.detach().clone() all_embeddings = all_embeddings.repeat(batch_num, 1) weights = weights_arr.view(node_num, -1) cos_ji_mat = torch.matmul(weights, weights.T) normed_mat = torch.matmul(weights.norm(dim=-1).view(-1,1), weights.norm(dim=-1).view(1,-1)) cos_ji_mat = cos_ji_mat / normed_mat dim = weights.shape[-1] topk_num = self.topk topk_indices_ji = torch.topk(cos_ji_mat, topk_num, dim=-1)[1] self.learned_graph = topk_indices_ji gated_i = torch.arange(0, node_num).T.unsqueeze(1).repeat(1, topk_num).flatten().to(device).unsqueeze(0) gated_j = topk_indices_ji.flatten().unsqueeze(0) gated_edge_index = torch.cat((gated_j, gated_i), dim=0) batch_gated_edge_index = get_batch_edge_index(gated_edge_index, batch_num, node_num).to(device) gcn_out = self.gnn_layers[i](x, batch_gated_edge_index, node_num=node_num*batch_num, embedding=all_embeddings) gcn_outs.append(gcn_out) x = torch.cat(gcn_outs, dim=1) x = x.view(batch_num, node_num, -1) indexes = torch.arange(0,node_num).to(device) out = torch.mul(x, self.embedding(indexes)) out = out.permute(0,2,1) out = F.relu(self.bn_outlayer_in(out)) out = out.permute(0,2,1) out = self.dp(out) out = self.out_layer(out) out = out.view(-1, node_num) return out

这是一个PyTorch模型的前向传播函数,它接受两个参数:data和org_edge_index。该函数使用GCN(图卷积神经网络)来处理输入数据,并返回一个输出张量。具体实现细节可以参考代码中的注释。

class AbstractGreedyAndPrune(): def __init__(self, aoi: AoI, uavs_tours: dict, max_rounds: int, debug: bool = True): self.aoi = aoi self.max_rounds = max_rounds self.debug = debug self.graph = aoi.graph self.nnodes = self.aoi.n_targets self.uavs = list(uavs_tours.keys()) self.nuavs = len(self.uavs) self.uavs_tours = {i: uavs_tours[self.uavs[i]] for i in range(self.nuavs)} self.__check_depots() self.reachable_points = self.__reachable_points() def __pruning(self, mr_solution: MultiRoundSolution) -> MultiRoundSolution: return utility.pruning_multiroundsolution(mr_solution) def solution(self) -> MultiRoundSolution: mrs_builder = MultiRoundSolutionBuilder(self.aoi) for uav in self.uavs: mrs_builder.add_drone(uav) residual_ntours_to_assign = {i : self.max_rounds for i in range(self.nuavs)} tour_to_assign = self.max_rounds * self.nuavs visited_points = set() while not self.greedy_stop_condition(visited_points, tour_to_assign): itd_uav, ind_tour = self.local_optimal_choice(visited_points, residual_ntours_to_assign) residual_ntours_to_assign[itd_uav] -= 1 tour_to_assign -= 1 opt_tour = self.uavs_tours[itd_uav][ind_tour] visited_points |= set(opt_tour.targets_indexes) # update visited points mrs_builder.append_tour(self.uavs[itd_uav], opt_tour) return self.__pruning(mrs_builder.build()) class CumulativeGreedyCoverage(AbstractGreedyAndPrune): choice_dict = {} for ind_uav in range(self.nuavs): uav_residual_rounds = residual_ntours_to_assign[ind_uav] if uav_residual_rounds > 0: uav_tours = self.uavs_tours[ind_uav] for ind_tour in range(len(uav_tours)): tour = uav_tours[ind_tour] quality_tour = self.evaluate_tour(tour, uav_residual_rounds, visited_points) choice_dict[quality_tour] = (ind_uav, ind_tour) best_value = max(choice_dict, key=int) return choice_dict[best_value] def evaluate_tour(self, tour : Tour, round_count : int, visited_points : set): new_points = (set(tour.targets_indexes) - visited_points) return round_count * len(new_points) 如何改写上述程序,使其能返回所有已经探索过的目标点visited_points的数量,请用代码表示

可以在 `solution()` 方法中添加一个变量来记录已经探索过的目标点数量,然后在每次更新 `visited_points` 后更新这个变量。下面是修改后的代码: ``` class AbstractGreedyAndPrune(): def __init__(self, aoi: AoI, uavs_tours: dict, max_rounds: int, debug: bool = True): self.aoi = aoi self.max_rounds = max_rounds self.debug = debug self.graph = aoi.graph self.nnodes = self.aoi.n_targets self.uavs = list(uavs_tours.keys()) self.nuavs = len(self.uavs) self.uavs_tours = {i: uavs_tours[self.uavs[i]] for i in range(self.nuavs)} self.__check_depots() self.reachable_points = self.__reachable_points() def __pruning(self, mr_solution: MultiRoundSolution) -> MultiRoundSolution: return utility.pruning_multiroundsolution(mr_solution) def solution(self) -> Tuple[MultiRoundSolution, int]: mrs_builder = MultiRoundSolutionBuilder(self.aoi) for uav in self.uavs: mrs_builder.add_drone(uav) residual_ntours_to_assign = {i : self.max_rounds for i in range(self.nuavs)} tour_to_assign = self.max_rounds * self.nuavs visited_points = set() explored_points = 0 while not self.greedy_stop_condition(visited_points, tour_to_assign): itd_uav, ind_tour = self.local_optimal_choice(visited_points, residual_ntours_to_assign) residual_ntours_to_assign[itd_uav] -= 1 tour_to_assign -= 1 opt_tour = self.uavs_tours[itd_uav][ind_tour] new_points = set(opt_tour.targets_indexes) - visited_points explored_points += len(new_points) visited_points |= new_points # update visited points mrs_builder.append_tour(self.uavs[itd_uav], opt_tour) return self.__pruning(mrs_builder.build()), explored_points class CumulativeGreedyCoverage(AbstractGreedyAndPrune): def evaluate_tour(self, tour : Tour, round_count : int, visited_points : set): new_points = set(tour.targets_indexes) - visited_points return round_count * len(new_points) def local_optimal_choice(self, visited_points, residual_ntours_to_assign): choice_dict = {} for ind_uav in range(self.nuavs): uav_residual_rounds = residual_ntours_to_assign[ind_uav] if uav_residual_rounds > 0: uav_tours = self.uavs_tours[ind_uav] for ind_tour in range(len(uav_tours)): tour = uav_tours[ind_tour] quality_tour = self.evaluate_tour(tour, uav_residual_rounds, visited_points) choice_dict[quality_tour] = (ind_uav, ind_tour) best_value = max(choice_dict, key=int) return choice_dict[best_value]
阅读全文

相关推荐

class SVDRecommender: def __init__(self, k=50, ncv=None, tol=0, which='LM', v0=None, maxiter=None, return_singular_vectors=True, solver='arpack'): self.k = k self.ncv = ncv self.tol = tol self.which = which self.v0 = v0 self.maxiter = maxiter self.return_singular_vectors = return_singular_vectors self.solver = solver def svds(self, A): if self.which == 'LM': largest = True elif self.which == 'SM': largest = False else: raise ValueError("which must be either 'LM' or 'SM'.") if not (isinstance(A, LinearOperator) or isspmatrix(A) or is_pydata_spmatrix(A)): A = np.asarray(A) n, m = A.shape if self.k <= 0 or self.k >= min(n, m): raise ValueError("k must be between 1 and min(A.shape), k=%d" % self.k) if isinstance(A, LinearOperator): if n > m: X_dot = A.matvec X_matmat = A.matmat XH_dot = A.rmatvec XH_mat = A.rmatmat else: X_dot = A.rmatvec X_matmat = A.rmatmat XH_dot = A.matvec XH_mat = A.matmat dtype = getattr(A, 'dtype', None) if dtype is None: dtype = A.dot(np.zeros([m, 1])).dtype else: if n > m: X_dot = X_matmat = A.dot XH_dot = XH_mat = _herm(A).dot else: XH_dot = XH_mat = A.dot X_dot = X_matmat = _herm(A).dot def matvec_XH_X(x): return XH_dot(X_dot(x)) def matmat_XH_X(x): return XH_mat(X_matmat(x)) XH_X = LinearOperator(matvec=matvec_XH_X, dtype=A.dtype, matmat=matmat_XH_X, shape=(min(A.shape), min(A.shape))) #获得隐式定义的格拉米矩阵的低秩近似。 eigvals, eigvec = eigsh(XH_X, k=self.k, tol=self.tol ** 2, maxiter=self.maxiter, ncv=self.ncv, which=self.which, v0=self.v0) #格拉米矩阵有实非负特征值。 eigvals = np.maximum(eigvals.real, 0) #使用来自pinvh的小特征值的复数检测。 t = eigvec.dtype.char.lower() factor = {'f': 1E3, 'd': 1E6} cond = factor[t] * np.finfo(t).eps cutoff = cond * np.max(eigvals) #获得一个指示哪些本征对不是简并微小的掩码, #并为阈值奇异值创建一个重新排序数组。 above_cutoff = (eigvals > cutoff) nlarge = above_cutoff.sum() nsmall = self.k - nlarge slarge = np.sqrt(eigvals[above_cutoff]) s = np.zeros_like(eigvals) s[:nlarge] = slarge if not self.return_singular_vectors: return np.sort(s) if n > m: vlarge = eigvec[:, above_cutoff] ularge = X_matmat(vlarge) / slarge if self.return_singular_vectors != 'vh' else None vhlarge = _herm(vlarge) else: ularge = eigvec[:, above_cutoff] vhlarge = _herm(X_matmat(ularge) / slarge) if self.return_singular_vectors != 'u' else None u = _augmented_orthonormal_cols(ularge, nsmall) if ularge is not None else None vh = _augmented_orthonormal_rows(vhlarge, nsmall) if vhlarge is not None else None indexes_sorted = np.argsort(s) s = s[indexes_sorted] if u is not None: u = u[:, indexes_sorted] if vh is not None: vh = vh[indexes_sorted] return u, s, vh def _augmented_orthonormal_cols(U, n): if U.shape[0] <= n: return U Q, R = np.linalg.qr(U) return Q[:, :n] def _augmented_orthonormal_rows(V, n): if V.shape[1] <= n: return V Q, R = np.linalg.qr(V.T) return Q[:, :n].T def _herm(x): return np.conjugate(x.T) 将上述代码修改为使用LM,迭代器使用arpack

from scipy.sparse.linalg import eigsh, LinearOperator from scipy.sparse import isspmatrix, is_pydata_spmatrix class SVDRecommender: def init(self, k=50, ncv=None, tol=0, which='LM', v0=None, maxiter=None, return_singular_vectors=True, solver='arpack'): self.k = k self.ncv = ncv self.tol = tol self.which = which self.v0 = v0 self.maxiter = maxiter self.return_singular_vectors = return_singular_vectors self.solver = solver def svds(self, A): largest = self.which == 'LM' if not largest and self.which != 'SM': raise ValueError("which must be either 'LM' or 'SM'.") if not (isinstance(A, LinearOperator) or isspmatrix(A) or is_pydata_spmatrix(A)): A = np.asarray(A) n, m = A.shape if self.k <= 0 or self.k >= min(n, m): raise ValueError("k must be between 1 and min(A.shape), k=%d" % self.k) if isinstance(A, LinearOperator): if n > m: X_dot = A.matvec X_matmat = A.matmat XH_dot = A.rmatvec XH_mat = A.rmatmat else: X_dot = A.rmatvec X_matmat = A.rmatmat XH_dot = A.matvec XH_mat = A.matmat dtype = getattr(A, 'dtype', None) if dtype is None: dtype = A.dot(np.zeros([m, 1])).dtype else: if n > m: X_dot = X_matmat = A.dot XH_dot = XH_mat = _herm(A).dot else: XH_dot = XH_mat = A.dot X_dot = X_matmat = _herm(A).dot def matvec_XH_X(x): return XH_dot(X_dot(x)) def matmat_XH_X(x): return XH_mat(X_matmat(x)) XH_X = LinearOperator(matvec=matvec_XH_X, dtype=A.dtype, matmat=matmat_XH_X, shape=(min(A.shape), min(A.shape))) eigvals, eigvec = eigsh(XH_X, k=self.k, tol=self.tol ** 2, maxiter=self.maxiter, ncv=self.ncv, which=self.which, v0=self.v0) eigvals = np.maximum(eigvals.real, 0) t = eigvec.dtype.char.lower() factor = {'f': 1E3, 'd': 1E6} cond = factor[t] * np.finfo(t).eps cutoff = cond * np.max(eigvals) above_cutoff = (eigvals > cutoff) nlarge = above_cutoff.sum() nsmall = self.k - nlarge slarge = np.sqrt(eigvals[above_cutoff]) s = np.zeros_like(eigvals) s[:nlarge] = slarge if not self.return_singular_vectors: return np.sort(s) if n > m: vlarge = eigvec[:, above_cutoff] ularge = X_matmat(vlarge) / slarge if self.return_singular_vectors != 'vh' else None vhlarge = _herm(vlarge) else: ularge = eigvec[:, above_cutoff] vhlarge = _herm(X_matmat(ularge) / slarge) if self.return_singular_vectors != 'u' else None u = _augmented_orthonormal_cols(ularge, nsmall) if ularge is not None else None vh = _augmented_orthonormal_rows(vhlarge, nsmall) if vhlarge is not None else None indexes_sorted = np.argsort(s) s = s[indexes_sorted] if u is not None: u = u[:, indexes_sorted] if vh is not None: vh = vh[indexes_sorted] return u, s, vh def _augmented_orthonormal_cols(U, n): if U.shape[0] <= n: return U Q, R = np.linalg.qr(U) return Q[:, :n] def _augmented_orthonormal_rows(V, n): if V.shape[1] <= n: return V Q, R = np.linalg.qr(V.T) return Q[:, :n].T def _herm(x): return np.conjugate(x.T)这段代码中使用的scipy包太旧了,导致会出现报错信息为:cannot import name 'is_pydata_spmatrix' from 'scipy.sparse' (D:\Anaconda\lib\site-packages\scipy\sparse_init.py),将这段代码修改为使用最新版的scipy包

class SVDRecommender: def init(self, k=50, ncv=None, tol=0, which='LM', v0=None, maxiter=None, return_singular_vectors=True, solver='arpack'): self.k = k self.ncv = ncv self.tol = tol self.which = which self.v0 = v0 self.maxiter = maxiter self.return_singular_vectors = return_singular_vectors self.solver = solver def svds(self, A): if which == 'LM': largest = True elif which == 'SM': largest = False else: raise ValueError("which must be either 'LM' or 'SM'.") if not (isinstance(A, LinearOperator) or isspmatrix(A) or is_pydata_spmatrix(A)): A = np.asarray(A) n, m = A.shape if k <= 0 or k >= min(n, m): raise ValueError("k must be between 1 and min(A.shape), k=%d" % k) if isinstance(A, LinearOperator): if n > m: X_dot = A.matvec X_matmat = A.matmat XH_dot = A.rmatvec XH_mat = A.rmatmat else: X_dot = A.rmatvec X_matmat = A.rmatmat XH_dot = A.matvec XH_mat = A.matmat dtype = getattr(A, 'dtype', None) if dtype is None: dtype = A.dot(np.zeros([m, 1])).dtype else: if n > m: X_dot = X_matmat = A.dot XH_dot = XH_mat = _herm(A).dot else: XH_dot = XH_mat = A.dot X_dot = X_matmat = _herm(A).dot def matvec_XH_X(x): return XH_dot(X_dot(x)) def matmat_XH_X(x): return XH_mat(X_matmat(x)) XH_X = LinearOperator(matvec=matvec_XH_X, dtype=A.dtype, matmat=matmat_XH_X, shape=(min(A.shape), min(A.shape))) # Get a low rank approximation of the implicitly defined gramian matrix. eigvals, eigvec = eigsh(XH_X, k=k, tol=tol ** 2, maxiter=maxiter, ncv=ncv, which=which, v0=v0) # Gramian matrix has real non-negative eigenvalues. eigvals = np.maximum(eigvals.real, 0) # Use complex detection of small eigenvalues from pinvh. t = eigvec.dtype.char.lower() factor = {'f': 1E3, 'd': 1E6} cond = factor[t] * np.finfo(t).eps cutoff = cond * np.max(eigvals) # Get a mask indicating which eigenpairs are not degenerate tiny, # and create a reordering array for thresholded singular values. above_cutoff = (eigvals > cutoff) nlarge = above_cutoff.sum() nsmall = k - nlarge slarge = np.sqrt(eigvals[above_cutoff]) s = np.zeros_like(eigvals) s[:nlarge] = slarge if not return_singular_vectors: return np.sort(s) if n > m: vlarge = eigvec[:, above_cutoff] ularge = X_matmat(vlarge) / slarge if return_singular_vectors != 'vh' else None vhlarge = _herm(vlarge) else: ularge = eigvec[:, above_cutoff] vhlarge = _herm(X_matmat(ularge) / slarge) if return_singular_vectors != 'u' else None u = _augmented_orthonormal_cols(ularge, nsmall) if ularge is not None else None vh = _augmented_orthonormal_rows(vhlarge, nsmall) if vhlarge is not None else None indexes_sorted = np.argsort(s) s = s[indexes_sorted] if u is not None: u = u[:, indexes_sorted] if vh is not None: vh = vh[indexes_sorted] return u, s, vh将这段代码放入一个.py文件中,用Spyder查看,有报错,可能是缩进有问题,无法被调用,根据这个问题,给出解决办法,给出改正后的完整代码

bs_data = w_data[w_data['波束场景No'] == cross_data['波束场景No'][0]] 报错:Traceback (most recent call last): File "C:\Users\z84259074\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\core\indexes\base.py", line 3652, in get_loc return self._engine.get_loc(casted_key) File "pandas\_libs\index.pyx", line 147, in pandas._libs.index.IndexEngine.get_loc File "pandas\_libs\index.pyx", line 176, in pandas._libs.index.IndexEngine.get_loc File "pandas\_libs\hashtable_class_helper.pxi", line 7080, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas\_libs\hashtable_class_helper.pxi", line 7088, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: '波束场景No' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "D:\Users\z84259074\PycharmProjects\参数自优化\self_optimizing.py", line 127, in <module> data = optimizing() File "D:\Users\z84259074\PycharmProjects\参数自优化\self_optimizing.py", line 18, in __init__ self.optimizing_main() File "D:\Users\z84259074\PycharmProjects\参数自优化\self_optimizing.py", line 120, in optimizing_main self.child2=self.mutation_cdata(fitness_data,self.cross_data) File "D:\Users\z84259074\PycharmProjects\参数自优化\self_optimizing.py", line 86, in mutation_cdata bs_data = w_data[w_data['波束场景No'] == cross_data['波束场景No'][0]] File "C:\Users\z84259074\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\core\frame.py", line 3761, in __getitem__ indexer = self.columns.get_loc(key) File "C:\Users\z84259074\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\core\indexes\base.py", line 3654, in get_loc raise KeyError(key) from err KeyError: '波束场景No'

(random.randint(0, bs_data[12]-1))*3+bs_data[8] 报错:Traceback (most recent call last): File "C:\Users\z84259074\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\core\indexes\base.py", line 3652, in get_loc return self._engine.get_loc(casted_key) File "pandas\_libs\index.pyx", line 147, in pandas._libs.index.IndexEngine.get_loc File "pandas\_libs\index.pyx", line 176, in pandas._libs.index.IndexEngine.get_loc File "pandas\_libs\hashtable_class_helper.pxi", line 7080, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas\_libs\hashtable_class_helper.pxi", line 7088, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 12 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "d:\Users\z84259074\PycharmProjects\参数自优化\self_optimizing.py", line 128, in <module> data = optimizing() File "d:\Users\z84259074\PycharmProjects\参数自优化\self_optimizing.py", line 15, in __init__ self.optimizing_main() File "d:\Users\z84259074\PycharmProjects\参数自优化\self_optimizing.py", line 124, in optimizing_main self.child2=self.mutation_cdata(fitness_data,self.cross_data) File "d:\Users\z84259074\PycharmProjects\参数自优化\self_optimizing.py", line 92, in mutation_cdata print('cross_data[波束场景No]',bs_data[12]) File "C:\Users\z84259074\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\core\frame.py", line 3761, in __getitem__ indexer = self.columns.get_loc(key) File "C:\Users\z84259074\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\core\indexes\base.py", line 3654, in get_loc raise KeyError(key) from err KeyError: 12

Traceback (most recent call last): File "D:\Anaconda\lib\site-packages\pandas\core\indexes\base.py", line 3802, in get_loc return self._engine.get_loc(casted_key) File "pandas\_libs\index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc File "pandas\_libs\index.pyx", line 165, in pandas._libs.index.IndexEngine.get_loc File "pandas\_libs\hashtable_class_helper.pxi", line 5745, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas\_libs\hashtable_class_helper.pxi", line 5753, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 'A' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "e:\Mydata\py\提取指定范围excel数据.py", line 7, in <module> data = df.loc[0:9, 'A':'B'] # 例如提取第1行到第10行,第1列到第3列的数据 File "D:\Anaconda\lib\site-packages\pandas\core\indexing.py", line 1067, in __getitem__ return self._getitem_tuple(key) File "D:\Anaconda\lib\site-packages\pandas\core\indexing.py", line 1256, in _getitem_tuple return self._getitem_tuple_same_dim(tup) File "D:\Anaconda\lib\site-packages\pandas\core\indexing.py", line 924, in _getitem_tuple_same_dim retval = getattr(retval, self.name)._getitem_axis(key, axis=i) File "D:\Anaconda\lib\site-packages\pandas\core\indexing.py", line 1290, in _getitem_axis return self._get_slice_axis(key, axis=axis) File "D:\Anaconda\lib\site-packages\pandas\core\indexing.py", line 1324, in _get_slice_axis indexer = labels.slice_indexer(slice_obj.start, slice_obj.stop, slice_obj.step) File "D:\Anaconda\lib\site-packages\pandas\core\indexes\base.py", line 6559, in slice_indexer start_slice, end_slice = self.slice_locs(start, end, step=step) File "D:\Anaconda\lib\site-packages\pandas\core\indexes\base.py", line 6767, in slice_locs start_slice = self.get_slice_bound(start, "left") File "D:\Anaconda\lib\site-packages\pandas\core\indexes\base.py", line 6686, in get_slice_bound raise err File "D:\Anaconda\lib\site-packages\pandas\core\indexes\base.py", line 6680, in get_slice_bound slc = self.get_loc(label) File "D:\Anaconda\lib\site-packages\pandas\core\indexes\base.py", line 3804, in get_loc raise KeyError(key) from err KeyError: 'A'

最新推荐

recommend-type

[Oracle] dbms_metadata.get_ddl 的使用方法总结

如果需要获取一个模式下所有对象的DDL,可以编写脚本来遍历`DBA_TABLES`、`DBA_VIEWS`、`DBA_INDEXES`、`DBA_OBJECTS`等数据字典视图。例如,获取所有表的DDL: ```sql SET PAGESIZE 0 SET LONG 90000 SET FEEDBACK...
recommend-type

变电站缺陷检测数据集,标注为VOC格式

变电站缺陷检测数据集,标注为VOC格式 表计读数有错--------bjdsyc: 657 个文件 表计外壳破损--------bj_wkps: 481 个文件 异物鸟巢--------------yw_nc: 834 个文件 箱门闭合异常--------xmbhyc: 368 个文件 盖板破损--------------gbps: 568 个文件 异物挂空悬浮物-----yw_gkxfw: 679 个文件 呼吸器硅胶变色-----hxq_gjbs: 1140 个文件 表计表盘模糊--------bj_bpmh: 828 个文件 绝缘子破裂-----------jyz_pl: 389 个文件 表计表盘破损--------bj_bpps: 694 个文件 渗漏油地面油污-----sly_dmyw: 721 个文件 未穿安全帽-----------wcaqm: 467 个文件 未穿工装--------------wcgz: 661 个文件 吸烟--------------------xy: 578 个文件
recommend-type

CIS110班级页面时钟设计与HTML实现

资源摘要信息:"clock-for-cis110:班级页面" HTML知识点: 1. HTML基础结构:HTML页面通常以<!DOCTYPE html>声明开始,紧接着是<html>标签作为根元素,包含<head>和<body>两个主要部分。在<head>部分中,一般会设置页面的元数据如标题<title>、字符集<charset>、引入外部CSS和JavaScript文件等。而<body>部分则包含页面的所有可见内容。 2. HTML文档标题<title>:标题标签用于定义页面的标题,它会显示在浏览器的标签页上,并且对于搜索引擎优化来说很重要。例如,在"clock-for-cis110:班级页面"的项目中,<title>标签的内容应该与项目相关,比如“CIS110班级时钟”。 3. HTML元素和标签:HTML文档由各种元素组成,每个元素由一个开始标签、内容和一个结束标签构成。例如,<h1>CIS110班级时钟</h1>中的<h1>是一个标题标签,用于定义最大级别的标题。 4. CSS样式应用:在HTML文档中,通常通过<link>标签在<head>部分引入外部CSS文件,这些CSS文件定义了HTML元素的样式,如字体大小、颜色、布局等。在"CIS110班级时钟"项目中,CSS将用于美化时钟的外观,例如调整时钟背景颜色、数字显示样式、时钟边框样式等。 5. JavaScript交互:为了实现动态功能,如实时显示时间的时钟,通常会在HTML文档中嵌入JavaScript代码或引入外部JavaScript文件。JavaScript可以处理时间的获取、显示以及更新等逻辑。在"CIS110班级时钟"项目中,JavaScript将用于创建时钟功能,比如让时钟能够动起来,每秒更新一次显示的时间。 6. HTML文档头部内容:在<head>部分,除了<title>外,还可以包含<meta>标签来定义页面的元数据,如字符集<meta charset="UTF-8">,这有助于确保页面在不同浏览器中的正确显示。另外,还可以添加<link rel="stylesheet" href="style.css">来引入CSS文件。 7. HTML文档主体内容:<body>部分包含了页面的所有可见元素,比如标题、段落、图片、链接以及其他各种HTML标签。在"CIS110班级时钟"项目中,主体部分将包含时钟显示区域,可能会有一个用来展示当前时间的<div>容器,以及可能的按钮、设置选项等交互元素。 通过以上知识点的介绍,我们可以了解到"CIS110班级时钟"项目的HTML页面设计需要包含哪些基本元素和技术。这些技术涉及到了文档的结构化、内容的样式定义、用户交互的设计,以及脚本编程的实现。在实际开发过程中,开发者需要结合这些知识点,进行编码以完成项目的搭建和功能实现。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

【Python沉浸式音频体验】:虚拟现实中的音频处理技巧

![【Python沉浸式音频体验】:虚拟现实中的音频处理技巧](https://www.thetechinfinite.com/wp-content/uploads/2020/07/thetechinfinite-22-1024x576.jpg) # 1. 虚拟现实中的音频处理概述 虚拟现实技术已经不再是科幻小说中的概念,而是逐渐走入了我们的生活。在这个沉浸式的世界里,除了视觉效果外,音频处理也扮演了至关重要的角色。本章将为读者提供一个虚拟现实音频处理的概览,从基础理论到实际应用,从简单的音频增强到复杂的交互设计,我们将逐步深入探讨如何在虚拟环境中实现高质量的音频体验。 虚拟现实中的音频处
recommend-type

在单片机编程中,如何正确使用if-else语句进行条件判断?请结合实际应用场景给出示例。

单片机编程中,if-else语句是基本的控制结构,用于基于条件执行不同的代码段。这在处理输入信号、状态监测、决策制定等场景中至关重要。为了帮助你更好地理解和运用这一语句,推荐参考这份资源:《单片机C语言常用语句详解ppt课件.ppt》。这份PPT课件详细讲解了单片机C语言编程中常用语句的用法和案例,直接关联到你的问题。 参考资源链接:[单片机C语言常用语句详解ppt课件.ppt](https://wenku.csdn.net/doc/5r92v3nz85?spm=1055.2569.3001.10343) 在实际应用中,if-else语句通常用于根据传感器的读数或某个标志位的状态来控制设备
recommend-type

WEB进销存管理系统wbjxc v3.0:提升企业销售与服务效率

资源摘要信息:"WEB进销存管理系统wbjxc v3.0" 知识点一:WEB进销存管理系统概念 WEB进销存管理系统是一种基于Web技术的库存管理和销售管理系统,它能够通过互联网进行数据的收集、处理和存储。该系统可以帮助企业管理商品的进货、销售、库存等信息,通过实时数据更新,确保库存信息准确,提高销售管理效率。 知识点二:产品录入、销售、退回、统计、客户管理模块 该系统包括五个基本功能模块,分别是产品录入、销售管理、退货处理、销售统计和客户信息管理。 1. 产品录入模块:负责将新产品信息加入系统,包括产品名称、价格、规格、供应商等基本信息的录入。 2. 销售管理模块:记录每一次销售活动的详细信息,包括销售商品、销售数量、销售单价、客户信息等。 3. 退回管理模块:处理商品的退货操作,记录退货商品、退货数量、退货原因等。 4. 销售统计模块:对销售数据进行汇总和分析,提供销售报表,帮助分析销售趋势和预测未来销售。 5. 客户信息管理模块:存储客户的基本信息,包括客户的联系方式、购买历史记录、信用等级等,以便于更好地服务客户和管理客户关系。 知识点三:多级别管理安全机制 "多级别管理"意味着该系统能够根据不同职位或权限的员工提供不同层级的数据访问和操作权限。这样的机制能够保护数据的安全,避免敏感信息被非授权访问或篡改。系统管理员可以设定不同的角色,如管理员、销售员、仓库管理员等,每个角色都有预设的权限,来执行特定的操作。 知识点四:操作提示及双击与单击的区别 在系统操作指南中提到需要留意单击与双击操作的区别,这通常是因为不同操作会导致不同的系统反应或功能触发。例如,在某些情况下单击可能用于打开菜单或选项,而双击可能用于立即确认或执行某个命令。用户需要根据系统的提示,正确使用单击或双击,以确保操作的准确性和系统的顺畅运行。 知识点五:Asp源码 Asp是Active Server Pages的缩写,是一种服务器端脚本环境,用于创建动态交互式网页。当Asp代码被服务器执行后,结果以HTML格式发送到客户端浏览器。使用Asp编写的应用程序可以跨平台运行在Windows系列服务器上,兼容大多数浏览器。因此,Asp源码的提及表明wbjxc v3.0系统可能使用了Asp语言进行开发,并提供了相应的源代码文件,便于开发者进行定制、维护或二次开发。 知识点六:WEB进销存系统的应用场景 WEB进销存管理系统适用于各种规模的企业,尤其适合中大型企业以及具有多个销售渠道和分销商的公司。通过互联网的特性,该系统可以方便地实现远程办公、实时数据分析以及多部门协同工作,极大地提高了工作效率和业务响应速度。 知识点七:WEB进销存系统的开发工具和语言 虽然具体的技术栈没有明确提及,但鉴于ASP源码的使用,可以推测开发wbjxc v3.0系统可能涉及的技术和工具包括但不限于:HTML、CSS、JavaScript、VBScript(Asp脚本语言的一种),以及可能的数据库技术如Microsoft SQL Server或Access数据库等。这些技术组合起来为系统提供了前端展示、后端逻辑处理以及数据存储等完整的解决方案。 知识点八:WEB进销存系统的更新和版本迭代 标题中提到的"v3.0"表明wbjxc是一个具有版本迭代的产品,随着技术进步和用户需求的变化,系统会不断更新升级以满足新的要求。版本号的递增也说明系统经过了多次更新和改进,逐渐完善功能和用户体验。用户在升级时应关注新版本带来的功能变更以及可能需要进行的数据迁移和操作习惯调整。
recommend-type

"互动学习:行动中的多样性与论文攻读经历"

多样性她- 事实上SCI NCES你的时间表ECOLEDO C Tora SC和NCESPOUR l’Ingén学习互动,互动学习以行动为中心的强化学习学会互动,互动学习,以行动为中心的强化学习计算机科学博士论文于2021年9月28日在Villeneuve d'Asq公开支持马修·瑟林评审团主席法布里斯·勒菲弗尔阿维尼翁大学教授论文指导奥利维尔·皮耶昆谷歌研究教授:智囊团论文联合主任菲利普·普雷教授,大学。里尔/CRISTAL/因里亚报告员奥利维耶·西格德索邦大学报告员卢多维奇·德诺耶教授,Facebook /索邦大学审查员越南圣迈IMT Atlantic高级讲师邀请弗洛里安·斯特鲁布博士,Deepmind对于那些及时看到自己错误的人...3谢谢你首先,我要感谢我的两位博士生导师Olivier和Philippe。奥利维尔,"站在巨人的肩膀上"这句话对你来说完全有意义了。从科学上讲,你知道在这篇论文的(许多)错误中,你是我可以依
recommend-type

Python虚拟现实网络编程:多人互动体验的设计与实现

![Python虚拟现实网络编程:多人互动体验的设计与实现](https://img-blog.csdnimg.cn/4eac4f0588334db2bfd8d056df8c263a.png) # 1. Python虚拟现实网络编程概述 在当今数字化时代,Python作为一门充满活力的编程语言,以其简洁明了的语法和强大的社区支持,在网络编程和虚拟现实(VR)应用开发领域中占据着重要的地位。Python的虚拟现实网络编程不仅结合了网络技术与VR的交互特性,还为开发者提供了一个高效、灵活的编程环境,使得实现多人互动体验变得更加可行。 ## 1.1 虚拟现实技术与网络编程的融合 虚拟现实技术通
recommend-type

在单片机编程中,如何正确使用if-else语句进行条件判断?请结合实际应用场景给出示例。

在单片机C语言编程中,if-else语句是进行条件判断的基础,它能够根据不同的条件执行不同的代码块。为了更深入地了解这一常用语句,建议参考《单片机C语言常用语句详解ppt课件.ppt》。这份课件能够提供直观的演示和具体的编码示例,帮助你更好地理解如何在单片机编程中应用if-else语句。 参考资源链接:[单片机C语言常用语句详解ppt课件.ppt](https://wenku.csdn.net/doc/5r92v3nz85?spm=1055.2569.3001.10343) 以下是一个使用if-else语句进行条件判断的实际应用场景示例:假设我们要根据一个温度传感器的输入值来控制一