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

时间: 2024-05-23 07:15:53 浏览: 149
这两行代码是一个类的构造函数,用于初始化类的属性。第一行代码调用了父类的构造函数并传递了 `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

高分成品毕业设计《在线英语阅读分级平台,基于Vue.js+SpringBoot+MySQL开发》+源码+论文+说明文档+数据库

在线英语阅读分级平台在对开发工具的选择上也很慎重,为了便于开发实现,选择的开发工具为Eclipse,选择的数据库工具为Mysql。 关键词:在线英语阅读分级平台;SpringBoot框架,系统分析,数据库设计 - 不懂运行,下载完可以私聊问,可远程教学 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。 --------
recommend-type

菲格瑞思压力传感器原理探究

资源摘要信息:"菲格瑞思压力传感器工作原理简介" 菲格瑞思(Futek)是一家知名的传感器制造商,其产品广泛应用于工业、科研和消费类市场。本文档的目的是对菲格瑞思公司的压力传感器的工作原理进行简单了解。在正式讨论之前,首先需要明确一些基本概念,如压力传感器的定义、类型以及它们的工作原理。 压力传感器是一种检测装置,能够感受到被测量的压力,并将其转换为可用的输出信号。输出信号可以是模拟电压、电流信号,也可以是数字信号,这取决于传感器的内部电路和设计。根据不同的测量原理,压力传感器大致可分为电阻式、电容式、压电式、电磁式等多种类型。 电阻式压力传感器是最常见的一种类型,它通常是基于应变片技术。应变片是一种电阻材料,当它受到拉伸或压缩时,其电阻值会发生变化。在压力传感器中,应变片被粘贴到一个弹性体上,弹性体在受到压力作用时会产生变形。这种变形会导致应变片的电阻值发生变化,通过测量这种变化,就可以计算出施加的压力。 菲格瑞思压力传感器很可能使用了类似的原理。它可能包含了一个或多个应变片,当传感器感受到外部压力时,弹性体产生微小变形,导致应变片的电阻值产生变化。这一电阻变化会被传感器内的电路检测并转换成电信号,从而实现压力到电信号的转换。 电容式压力传感器则利用电容变化来检测压力变化。这种传感器通常由两个电极板和一个可移动的隔板组成。当压力作用于隔板上时,隔板会移动,改变电极板之间的距离,从而改变了两电极之间的电容量。测量电容的变化即可得知压力的大小。 压电式压力传感器基于压电效应,当某些材料(如石英晶体)受到压力时会在其两端产生电荷。这种电荷的产生与材料受到的压力成正比,因此可以作为测量压力的一种手段。 电磁式压力传感器则是利用变化的压力引起电磁场的改变来进行测量。这种传感器一般用于液位测量或非接触式压力测量。 了解了这些基本概念后,我们可以通过阅读文档“对菲格瑞思压力传感器的工作原理进行简单的了解.doc”来获取菲格瑞思公司产品特有的信息。文档中可能会详细描述该公司的压力传感器如何工作,包括其设计细节、如何实现精确测量,以及在不同应用场景下如何保持性能等。 在阅读文档时,应关注以下方面: 1. 传感器的构造和工作原理,包括它是如何将压力转换为电信号的。 2. 传感器的精确度、稳定性和可靠性,这对于工业应用尤其重要。 3. 传感器在不同环境下的性能,包括温度、湿度和压力范围的影响。 4. 传感器的输出特性,如它的线性度、滞后性和重复性。 5. 传感器的应用领域,这有助于了解在特定行业中如何选择和使用传感器。 通过上述内容,我们可以得出菲格瑞思压力传感器是一个用于检测压力变化并将其转换为电信号的精密设备。了解其工作原理有助于正确选择和应用这些传感器,以满足不同场合的精确测量需求。同时,细致研究该公司的产品文档也是获取详细技术信息和参数的重要途径。
recommend-type

管理建模和仿真的文件

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

GitHub高效管理秘籍:开源项目管理的10大实用技巧

![GitHub高效管理秘籍:开源项目管理的10大实用技巧](https://opengraph.githubassets.com/ae4901c7b2a37ac96ae797d902ca8816bcf70e1da498ce48ec16ad4d02f308fc/cwgem/Ruby-Documentation-Translation-Project) # 1. 开源项目管理的概述与GitHub基础 在当今的软件开发领域中,开源项目管理已经成为不可或缺的一部分。借助于GitHub等代码托管平台,开发者可以协作编写、共享代码,并管理项目的所有相关活动。本章将带你进入开源项目管理的世界,重点介绍其
recommend-type

回天TM系列如何利用CDP技术实现持续数据保护,并在企业级环境中提高数据备份与恢复的效率和精确性?

回天TM系列产品采用CDP(Continuous Data Protection)技术,为企业提供了实时数据备份和快速数据恢复的解决方案。CDP技术的核心优势在于其能够持续监控数据变化,并立即捕获所有数据的更新,从而实现几乎零数据丢失的备份。 参考资源链接:[蓝海本立回天TM系列:实时数据备份与恢复技术详解](https://wenku.csdn.net/doc/88sina3vqm?spm=1055.2569.3001.10343) 在企业级环境中,CDP技术通过以下几个方面提高了数据备份与恢复的效率和精确性: 1. 实时监控:CDP技术通过持续监控数据变化,确保了数据的实时备份。它不
recommend-type

求职者的福音:免费分享高颜值简历模板

资源摘要信息:"本资源是一个关于求职简历模板的分享,适用于大学生、应届生以及寻求实习机会的在校生。提供了多种简历模版,包括简约大气的风格、高颜值的设计等,满足不同求职者的需求。内容涵盖了个人信息、求职意向、教育背景、工作经验、技能和能力、实习与项目经验、获奖和荣誉、自我评价以及兴趣爱好等方面,旨在帮助求职者全面而专业地展示自我,提高求职成功率。" 标题中的知识点: - 简历模版:说明了资源是关于提供多种简历模板,供求职者下载使用。 - 应届生:指出了该简历模板适合的特定群体,即即将毕业或刚刚毕业的大学生。 - 高颜值简历模版:强调了简历设计的美观性,通常高颜值的设计能给人留下良好的第一印象。 - 个人简历模版:指明了这是一套针对个人求职需求的简历模板。 - 简约大气:描述了简历设计的风格特点,简约而大气的设计往往给人以专业感。 - 大学生在校生:指出了除应届生外,大学生在校生也是该简历模板的适用人群。 - 求职:说明了使用简历的目的,即求职。 - 实习:指出了除了全职工作外,该简历模板也可用于寻找实习机会。 描述中的知识点: - 简历格式:详细介绍了简历的基本结构和应该包含的主要内容。 - 头部信息:列出了简历开头需要提供的个人基本信息,如姓名、联系方式等。 - 求职目标:说明了在简历中可选择性地阐述个人的职业意向和目标,以吸引招聘方的注意。 - 教育背景:描述了如何清晰地列出个人的教育经历,包括学校、专业和就读时间等。 - 工作经验:指导如何有条理地呈现以往的工作经历,包括公司、职位、时间以及工作职责和成就。 - 技能和能力:强调了在简历中展示与职位相关的专业技能、语言能力和计算机技能的重要性。 - 实习经验/项目经验:指出如果有实习或项目经验,应当在简历中予以体现,以增强简历的竞争力。 - 获奖和荣誉:说明了添加在学术、工作或其他领域获得的奖项和荣誉,可以增加求职者的竞争力。 - 自我评价:讨论了求职者可提供对自身特点、能力和职业目标的简短描述,帮助招聘方了解个人性格和职业规划。 - 兴趣爱好:建议了在简历中适当列出兴趣爱好,可以展示求职者的多样性和个人素质。 - 参考人:提醒了如有推荐人,可以在简历中提供参考人的联系信息,以便招聘方进行背景调查。 标签中的知识点: - 范文/模板/素材:强调了资源提供的简历为模板形式,用户可以直接下载使用或作为参考进行修改。 - 简历:明确了该资源的主题,即与求职简历相关的内容。 压缩包子文件的文件名称列表中的知识点: - 54.docx:表示资源的压缩包中包含了以docx格式命名的Word文档,即具体的一个简历模板文件。 综上所述,资源提供的是一套适合大学生和应届生使用的求职简历模板,设计风格简约而具有吸引力,内容全面且实用,旨在帮助求职者更好地展示自己的专业技能和个人素质,从而提高求职成功率。资源的下载和使用能够方便快捷地帮助求职者制作出专业的简历。
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

PHP与MySQL:掌握环境搭建与高级交互技巧的终极指南

![PHP与MySQL:掌握环境搭建与高级交互技巧的终极指南](https://desarrolloweb.com/storage/collection_images/actual/xZ0LSdAUsp6NnK4EWDsopANmk3iqMYek2SJV3ZWH.jpg) # 1. PHP与MySQL基础知识回顾 ## 1.1 PHP基础 PHP(Hypertext Preprocessor)是一种广泛使用的开源服务器端脚本语言,专门用于Web开发。理解PHP的基本语法是开发动态网站的基础。重要的概念包括变量声明、数据类型、运算符、控制结构(如if-else语句和循环),以及面向对象编程的基
recommend-type

在Matlab中如何利用SSA-XGBoost算法优化分类预测模型的参数,并提高预测准确率?请结合源码和结果分析给出具体步骤。

在Matlab中实现SSA-XGBoost算法,首先需要了解算法的基本原理和Matlab的编程特性。SSA-XGBoost结合了麻雀搜索算法(SSA)和XGBoost分类算法,SSA用于参数优化,XGBoost负责构建高效的分类模型。在Matlab环境中,可以通过编写参数化程序来灵活地调整模型参数,并通过多次迭代不断优化。 参考资源链接:[Matlab源码实现SSA-XGBoost麻雀算法优化分类预测](https://wenku.csdn.net/doc/62ixckcj0s?spm=1055.2569.3001.10343) 具体实现步骤如下: 1. 初始化SSA参数,如种群大小、最